#include <QtGui>
#include <QDebug>
const int DIALOG_MARGIN = 10;
const int DIALOG_SPACING = 10;
Q_OBJECT
public:
setObjectName(name);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
int nb_entries = 10;
for (int i = 0; i< nb_entries; i++)
}
};
class GetUpdateList
: public QDialog { Q_OBJECT
DiskList *disklist;
public:
whole->setObjectName("whole");
whole->setMargin(DIALOG_MARGIN);
whole->addWidget( disklist= new DiskList( this, "disklist"), 0, 0);
whole->addSpacing(DIALOG_SPACING);
connect( update, SIGNAL(clicked()), SLOT(updatedb()) );
buttons->addWidget(update, 0, 0);
connect( done, SIGNAL(clicked()), SLOT(accept()) );
buttons->addWidget(done, 0, 0);
whole->addLayout(buttons);
setLayout(whole);
// Want to force a particular starting size?
// resize(800, 600);
}
};
int main(int argc, char *argv[])
{
GetUpdateList gul;
gul.show();
return app.exec();
}
#include "main.moc"
#include <QtGui>
#include <QDebug>
const int DIALOG_MARGIN = 10;
const int DIALOG_SPACING = 10;
class DiskList: public QListWidget {
Q_OBJECT
public:
DiskList( QWidget *parent, const char *name) : QListWidget(parent) {
setObjectName(name);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
int nb_entries = 10;
setSelectionMode(QAbstractItemView::ExtendedSelection);
setResizeMode(QListView::Adjust);
for (int i = 0; i< nb_entries; i++)
addItem(new QListWidgetItem(QString("Entry %1").arg(i) + tr(" (removable drive)")));
}
};
class GetUpdateList: public QDialog {
Q_OBJECT
DiskList *disklist;
QPushButton *update;
QPushButton *done;
public:
GetUpdateList( QWidget *parent = 0) : QDialog( parent) {
QVBoxLayout * whole = new QVBoxLayout;
whole->setObjectName("whole");
whole->setMargin(DIALOG_MARGIN);
whole->addWidget( disklist= new DiskList( this, "disklist"), 0, 0);
whole->addSpacing(DIALOG_SPACING);
QHBoxLayout *buttons = new QHBoxLayout();
update = new QPushButton( tr("&Update"), this );
connect( update, SIGNAL(clicked()), SLOT(updatedb()) );
buttons->addWidget(update, 0, 0);
done = new QPushButton( tr("&Done"), this );
connect( done, SIGNAL(clicked()), SLOT(accept()) );
buttons->addWidget(done, 0, 0);
whole->addLayout(buttons);
setLayout(whole);
// Want to force a particular starting size?
// resize(800, 600);
}
};
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
GetUpdateList gul;
gul.show();
return app.exec();
}
#include "main.moc"
To copy to clipboard, switch view to plain text mode
Bookmarks