Originally Posted by
roseicollis
Obviously I don't have this cpp... dunno for what is that line but I didnt wrote it:
SOURCES = progressbartest.cpp
SOURCES = progressbartest.cpp
To copy to clipboard, switch view to plain text mode
That is obviously the C++ code I've posted.
Originally Posted by
roseicollis
Based on Qt 4.8.5
Works the same way in Qt4 as far as the progressbar is concerned.
#include <QtGui>
{
Q_OBJECT
public:
{
connect(&mTimer, SIGNAL(timeout()), this, SLOT(advance()));
}
void start(int interval)
{
mTimer.start(interval);
}
private:
private slots:
void advance()
{
mBar->setValue(mBar->value() + 1);
}
};
int main(int argc, char ** argv)
{
bar.setMinimum(0);
bar.setMaximum(0);
bar.resize(300, bar.sizeHint().height());
bar.show();
Advancer *advancer = new Advancer(&bar);
advancer->start(500);
return app.exec();
}
#include "progressbartestqt4.moc"
#include <QtGui>
class Advancer : public QObject
{
Q_OBJECT
public:
explicit Advancer(QProgressBar *bar) : QObject(bar), mBar(bar)
{
connect(&mTimer, SIGNAL(timeout()), this, SLOT(advance()));
}
void start(int interval)
{
mTimer.start(interval);
}
private:
QProgressBar *mBar;
QTimer mTimer;
private slots:
void advance()
{
mBar->setValue(mBar->value() + 1);
}
};
int main(int argc, char ** argv)
{
QApplication app(argc, argv);
QProgressBar bar;
bar.setMinimum(0);
bar.setMaximum(0);
bar.resize(300, bar.sizeHint().height());
bar.show();
Advancer *advancer = new Advancer(&bar);
advancer->start(500);
return app.exec();
}
#include "progressbartestqt4.moc"
To copy to clipboard, switch view to plain text mode
TEMPLATE = app
SOURCES = progressbartestqt4.cpp
TEMPLATE = app
SOURCES = progressbartestqt4.cpp
To copy to clipboard, switch view to plain text mode
Cheers,
_
Bookmarks