Commit d4fae3f2 by Kai Westerkamp

slider fix

parent 194aa735
...@@ -47,7 +47,7 @@ MainWindow::MainWindow(QWidget *parent) : ...@@ -47,7 +47,7 @@ MainWindow::MainWindow(QWidget *parent) :
subdivSlider->setSingleStep(1); subdivSlider->setSingleStep(1);
connect(subdivSlider, SIGNAL(valueChanged(int)), connect(subdivSlider, SIGNAL(valueChanged(int)),
m_centralWidget, SLOT(subdivide(int))); this, SLOT(sliderfix(int)));
toolBar->addWidget(subdivSlider); toolBar->addWidget(subdivSlider);
...@@ -56,6 +56,16 @@ MainWindow::MainWindow(QWidget *parent) : ...@@ -56,6 +56,16 @@ MainWindow::MainWindow(QWidget *parent) :
// showMaximized(); // showMaximized();
} }
void MainWindow::sliderfix(int pos){
int move = pos -oldSliderpos;
move >0 ? move = 1 : move = -1;
int newPos = oldSliderpos+move;
// qDebug()<<"SliderPos"<<oldSliderpos<<move<<newPos;
m_centralWidget->subdivide(newPos);
subdivSlider->setSliderPosition(newPos);
oldSliderpos = newPos;
}
MainWindow::~MainWindow() MainWindow::~MainWindow()
{ {
} }
...@@ -19,7 +19,11 @@ public: ...@@ -19,7 +19,11 @@ public:
explicit MainWindow(QWidget *parent = 0); explicit MainWindow(QWidget *parent = 0);
~MainWindow(); ~MainWindow();
public slots:
void sliderfix(int pos);
private: private:
int oldSliderpos = 0;
MainWidget *m_centralWidget; MainWidget *m_centralWidget;
QToolBar *toolBar; QToolBar *toolBar;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment