QWidget *Frame::createCategoryPage( CategoryInterface *c ) { QButtonGroup *g = new QButtonGroup( 1, Horizontal, toolBox ); g->setFrameStyle( QFrame::NoFrame ); g->setEraseColor(green); g->setBackgroundMode(PaletteBase); for ( int i = 0; i < c->numCategories(); ++i ) { QToolButton *b = new QToolButton( g ); b->setBackgroundMode(PaletteBase); b->setTextLabel( c->categoryName( i ) ); b->setIconSet( c->categoryIcon( i ) ); b->setAutoRaise( TRUE ); b->setTextPosition( QToolButton::Right ); b->setUsesTextLabel( TRUE ); g->insert( b, i + c->categoryOffset() ); connect( g, SIGNAL( clicked( int ) ), c, SLOT( setCurrentCategory( int ) ) ); } return g; }
DelegateDialog::DelegateDialog(QWidget *parent) : KDialogBase(parent, "", true, "", Ok | Cancel, Ok, true) { QWidget *page = new QWidget(this); QGridLayout *layout = new QGridLayout(page, 5, 3, 11, 6); QLabel *label = new QLabel(i18n("User:"******"...")); layout->addWidget(emailSelector, 0, 2); QValueList<Scalix::DelegateTypes> types; types << Scalix::SendOnBehalfOf; types << Scalix::SeePrivate; types << Scalix::GetMeetings; types << Scalix::InsteadOfMe; int row = 1; for(uint i = 0; i < types.count(); ++i) { QCheckBox *box = new QCheckBox(Scalix::Delegate::rightsAsString(types[ i ]), page); layout->addMultiCellWidget(box, row, row, 1, 2); mRights.insert(types[ i ], box); row++; } connect(emailSelector, SIGNAL(clicked()), SLOT(selectEmail())); setMainWidget(page); }
MainWindow::MainWindow(QWidget *parent): QMainWindow(parent) { d_plot = new Plot(this); setCentralWidget(d_plot); QToolBar *toolBar = new QToolBar(this); QToolButton *btnSpectrogram = new QToolButton(toolBar); QToolButton *btnContour = new QToolButton(toolBar); QToolButton *btnPrint = new QToolButton(toolBar); #if QT_VERSION >= 0x040000 btnSpectrogram->setText("Spectrogram"); //btnSpectrogram->setIcon(QIcon()); btnSpectrogram->setCheckable(true); btnSpectrogram->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); toolBar->addWidget(btnSpectrogram); btnContour->setText("Contour"); //btnContour->setIcon(QIcon()); btnContour->setCheckable(true); btnContour->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); toolBar->addWidget(btnContour); btnPrint->setText("Print"); btnPrint->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); toolBar->addWidget(btnPrint); #else btnSpectrogram->setTextLabel("Spectrogram"); //btnSpectrogram->setPixmap(zoom_xpm); btnSpectrogram->setToggleButton(true); btnSpectrogram->setUsesTextLabel(true); btnContour->setTextLabel("Contour"); //btnContour->setPixmap(zoom_xpm); btnContour->setToggleButton(true); btnContour->setUsesTextLabel(true); btnPrint->setTextLabel("Print"); btnPrint->setUsesTextLabel(true); #endif addToolBar(toolBar); connect(btnSpectrogram, SIGNAL(toggled(bool)), d_plot, SLOT(showSpectrogram(bool))); connect(btnContour, SIGNAL(toggled(bool)), d_plot, SLOT(showContour(bool))); connect(btnPrint, SIGNAL(clicked()), d_plot, SLOT(printPlot()) ); #if QT_VERSION >= 0x040000 btnSpectrogram->setChecked(true); btnContour->setChecked(false); #else btnSpectrogram->setOn(true); btnContour->setOn(false); #endif }