Skip to content
Snippets Groups Projects
Commit c7211cff authored by pospelov's avatar pospelov
Browse files

Added delay to TQtWidget to make resize of widget smooth and taking less CPU...

Added delay to TQtWidget to make resize of widget smooth and taking less CPU (will be improved further)
parent e356382b
No related branches found
No related tags found
No related merge requests found
......@@ -69,7 +69,8 @@ void JobView::updateGraphics()
gStyle->SetPalette(1);
gStyle->SetOptStat(0);
mp_cached_histo->SetMinimum(1.);
mp_cached_histo->Draw("CONTZ");
//mp_cached_histo->Draw("CONTZ");
mp_cached_histo->Draw("CONT4 Z");
mp_canvas->Update();
std::cout << "XXX update " << (ncalls++) << std::endl;
}
......
......@@ -120,8 +120,8 @@ void SimulationView::onRunSimulation()
mp_simulation_data_model->addJob(p_new_job->getName(), p_new_job);
p_new_job->start();
// initialize a Simulation object and run it
QMessageBox::information(this, tr("Simulation Started"),
tr("The simulation is now calculating."));
// QMessageBox::information(this, tr("Simulation Started"),
// tr("The simulation is now calculating."));
}
void SimulationView::onPythonJobLaunched()
......@@ -155,3 +155,4 @@ void SimulationView::onJobFinished()
QMessageBox::information(this, tr("Simulation Job Finished"),
tr("A simulation job has finished."));
}
......@@ -19,7 +19,7 @@ public:
public slots:
void onRunSimulation();
void onPythonJobLaunched();
void onJobFinished();
Q_INVOKABLE void onJobFinished();
private:
SimulationDataModel *mp_simulation_data_model;
......
......@@ -76,7 +76,6 @@ INCLUDEPATH += $$PWD/../externals/qt-manhattan-style
LIBS += $$PWD/../../lib/libQtRoot.so $$PWD/../../lib/libGQt.so
INCLUDEPATH += $$PWD/../externals/qt-root/inc
# ROOT libraries integration
#LIBS += $$PWD/../../lib/libQtRoot.so /Users/pospelov/nest/software/root/qtroot/qtroot/libGQt.dylib
#INCLUDEPATH += /Users/pospelov/nest/software/root/qtroot/qtroot/qt/inc
......
......@@ -106,7 +106,7 @@ public:
virtual int baseFontPointSize() const = 0;
virtual void setBaseFontPointSize(int size) = 0;
virtual void setForegroundColor(const QColor &) = 0;
virtual bool isMine() const { return false;};
virtual bool isMine() const { return false;}
virtual TQtTextProxy *Clone() = 0;
};
inline bool TQtTextProxy::setContent(const char *text, QString *errorMsg,
......
......@@ -803,6 +803,7 @@ TGQt::TGQt() : TVirtualX(),fDisplayOpened(kFALSE),fQPainter(0),fhEvent ()
fgTQt = this;
gQt = this;
fSelectedWindow = fPrevWindow = NoOperation;
// fQPainter = new TQtPainter(this);
}
//______________________________________________________________________________
......@@ -819,6 +820,7 @@ TGQt::TGQt(const char *name, const char *title) : TVirtualX(name,title),fDisplay
fSelectedWindow = fPrevWindow = NoOperation;
CreateQtApplicationImp();
Init();
// fQPainter = new TQtPainter(this);
}
//______________________________________________________________________________
......@@ -841,6 +843,7 @@ TGQt::~TGQt()
delete fQClientFilterBuffer; fQClientFilterBuffer = 0;
delete fgTextProxy; fgTextProxy = 0;
// --- delete fQPainter; fQPainter = 0;
// delete fQPainter;
}
// Stop GUI thread
TQtApplication::Terminate();
......@@ -1479,6 +1482,14 @@ void TGQt::DrawFillArea(int n, TPoint *xy)
TPoint *rootPoint = xy;
for (int i =0;i<n;i++,rootPoint++) qtPoints.setPoint(i,rootPoint->fX,rootPoint->fY);
p.drawPolygon(qtPoints);
// std::cout << "XXX " << fQPainter << std::endl;
// if (fQBrush->style() == Qt::SolidPattern) fQPainter->setPen(Qt::NoPen);
// QPolygon qtPoints(n);
// TPoint *rootPoint = xy;
// for (int i =0;i<n;i++,rootPoint++) qtPoints.setPoint(i,rootPoint->fX,rootPoint->fY);
// fQPainter->drawPolygon(qtPoints);
}
}
......
......@@ -439,21 +439,25 @@ void TQtWidget::Refresh()
if (!fRefreshTimer) {
fRefreshTimer = new QTimer(this);
fRefreshTimer->setSingleShot(true);
fRefreshTimer->setInterval(0);
fRefreshTimer->setInterval(100);
connect(fRefreshTimer, SIGNAL(timeout()), this, SLOT(RefreshCB()));
}
fRefreshTimer->start();
}
#include <iostream>
//_____________________________________________________________________________
void TQtWidget::RefreshCB()
{
// [slot] to allow Qt signal refreshing the ROOT TCanvas if needed
static int inum=0;
TCanvas *c = Canvas();
if (c) {
c->Modified();
c->Resize();
c->Update();
std::cout << "TQtWidget::RefreshCB -> XXX " << (inum++) << std::endl;
}
if (!fInsidePaintEvent) { update(); }
else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment