mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-07 03:30:44 +00:00
71 lines
1.7 KiB
C++
71 lines
1.7 KiB
C++
|
#include "gSplitter.h"
|
||
|
#include "graphwindow.h"
|
||
|
#include <QDebug>
|
||
|
gSplitter::gSplitter(QWidget *parent) :
|
||
|
QSplitter(parent)
|
||
|
{
|
||
|
z_timer=new QTimer(this);
|
||
|
|
||
|
//timer=NULL;
|
||
|
// icnt=0;
|
||
|
}
|
||
|
gSplitter::gSplitter(Qt::Orientation orientation, QWidget *parent) :
|
||
|
QSplitter(orientation,parent)
|
||
|
{
|
||
|
// icnt=0;
|
||
|
this->connect(this,SIGNAL(splitterMoved(int,int)),SLOT(mySplitterMoved(int,int)));
|
||
|
z_timer=new QTimer(this);
|
||
|
}
|
||
|
gSplitter::~gSplitter()
|
||
|
{
|
||
|
delete z_timer;
|
||
|
this->disconnect(SLOT(mySplitterMoved(int,int)));
|
||
|
// timer->stop();
|
||
|
}
|
||
|
|
||
|
void gSplitter::mySplitterMoved (int pos, int index)
|
||
|
{
|
||
|
if (z_timer->isActive()) z_timer->stop();
|
||
|
z_pos=pos;
|
||
|
z_index=index;
|
||
|
this->setUpdatesEnabled(true);
|
||
|
if (gGraphWindow *w=qobject_cast<gGraphWindow *>(widget(index-1))) {
|
||
|
int s=sizes().at(index-1);
|
||
|
w->updateGL();
|
||
|
//w->resizeGL(w->width(),pos);
|
||
|
//w->updateGL();
|
||
|
//w->paintGL();
|
||
|
}
|
||
|
if (gGraphWindow *w=qobject_cast<gGraphWindow *>(widget(index))) {
|
||
|
int s=sizes().at(index);
|
||
|
//w->resizeGL(w->width(),s);
|
||
|
//w->updateGL();
|
||
|
//w->paintGL();
|
||
|
}
|
||
|
qDebug() << ++icnt;
|
||
|
z_timer->singleShot(50,this,SLOT(doUpdateGraph()));
|
||
|
tm.start();
|
||
|
this->setUpdatesEnabled(false);
|
||
|
}
|
||
|
|
||
|
void gSplitter::doUpdateGraph()
|
||
|
{
|
||
|
|
||
|
if (tm.elapsed()<50)
|
||
|
return;
|
||
|
|
||
|
if (gGraphWindow *w=qobject_cast<gGraphWindow *>(widget(z_index))) {
|
||
|
qDebug() << icnt << "Height" << w->height() << z_index << z_pos << w->Title();
|
||
|
|
||
|
int s=sizes().at(z_index);
|
||
|
|
||
|
this->setUpdatesEnabled(true);
|
||
|
w->resizeGL(w->width(),s);
|
||
|
w->paintGL();
|
||
|
}
|
||
|
//timer->stop();
|
||
|
icnt=0;
|
||
|
// QSplitter::resizeEvent(&event);
|
||
|
|
||
|
}
|