QWidget* TabbedConfigurationGroup::configWidget(ConfigurationGroup *cg, QWidget* parent, const char* widgetName) { QTabDialog* widget = new QTabDialog(parent, widgetName); widget->setBackgroundOrigin(QWidget::WindowOrigin); for(unsigned i = 0 ; i < children.size() ; ++i) if (children[i]->isVisible()) widget->addTab(children[i]->configWidget(cg, widget), children[i]->getLabel()); if (cg) { connect(this, SIGNAL(changeHelpText(QString)), cg, SIGNAL(changeHelpText(QString))); } return widget; };
int main( int argc, char *argv[] ){ KApplication a( argc, argv, "kfontmanager" ); // KApplication's general font should be used or charset properly set // a.setFont(QFont("Helvetica",12,QFont::Normal),TRUE); sprintf( PICS_PATH, "%s/kfontmanager/pics", KApplication::kde_datadir().data() ); QTabDialog* mainWindow = new QTabDialog( 0, 0, TRUE ); QString str; str = i18n("KDE Font Manager"); str += ' '; str += KFONTMANAGERVERSION; mainWindow->setCaption(str.data()); mainWindow->setCancelButton(i18n("Cancel")); mainWindow->setApplyButton(i18n("Apply")); KFontManager manager(mainWindow,"manager"); KFontExplorer explorer(mainWindow,"explorer"); KFontList list(mainWindow,"list"); mainWindow->addTab( &manager, i18n("KDE Fonts") ); mainWindow->addTab( &explorer,i18n("Font Explorer")); mainWindow->addTab( &list, i18n("Raw X11 Font List") ); a.enableSessionManagement(true); a.setWmCommand(argv[0]); a.setTopWidget(mainWindow); mainWindow->resize( 430, 450 ); mainWindow->exec(); return 0; }
void QtCalculator::configclicked(){ QTabDialog * tabdialog; tabdialog = new QTabDialog(0,"tabdialog",TRUE); tabdialog->setCaption( i18n("KCalc Configuration") ); tabdialog->resize( 360, 390 ); tabdialog->setCancelButton( i18n("&Cancel") ); tabdialog->setOKButton(i18n("&OK")); QWidget *about = new QWidget(tabdialog,"about"); QVBoxLayout *lay1 = new QVBoxLayout( about ); lay1->setMargin( KDialog::marginHint() ); lay1->setSpacing( KDialog::spacingHint() ); QGroupBox *box = new QGroupBox(0,Qt::Vertical,about,"box"); box->layout()->setSpacing(KDialog::spacingHint()); box->layout()->setMargin(KDialog::marginHint()); QGridLayout *grid1 = new QGridLayout(box->layout(),2,2); QLabel *label = new QLabel(box,"label"); QLabel *label2 = new QLabel(box,"label2"); box->setTitle(i18n("About")); grid1->addWidget(label,0,1); grid1->addMultiCellWidget(label2,2,2,0,1); QString labelstring = "KCalc "KCALCVERSION"\n"\ "Bernd Johannes Wuebben\n"\ "[email protected]\n"\ "[email protected]\n"\ "Copyright (C) 1996-98\n"\ "\n\n"; QString labelstring2 = #ifdef HAVE_LONG_DOUBLE i18n( "Base type: long double\n"); #else i18n( "Due to broken glibc's everywhere, "\ "I had to reduce KCalc's precision from 'long double' "\ "to 'double'. "\ "Owners of systems with a working libc "\ "should recompile KCalc with 'long double' precision "\ "enabled. See the README for details."); #endif label->setAlignment(AlignLeft|WordBreak|ExpandTabs); label->setText(labelstring); label2->setAlignment(AlignLeft|WordBreak|ExpandTabs); label2->setText(labelstring2); // HACK // QPixmap pm( BarIcon( "kcalclogo" ) ); QPixmap pm; QLabel *logo = new QLabel(box); logo->setPixmap(pm); grid1->addWidget(logo,0,0); lay1->addWidget(box); DefStruct newdefstruct; newdefstruct.forecolor = kcalcdefaults.forecolor; newdefstruct.backcolor = kcalcdefaults.backcolor; newdefstruct.precision = kcalcdefaults.precision; newdefstruct.fixedprecision = kcalcdefaults.fixedprecision; newdefstruct.fixed = kcalcdefaults.fixed; newdefstruct.style = kcalcdefaults.style; newdefstruct.beep = kcalcdefaults.beep; ConfigDlg *configdlg; configdlg = new ConfigDlg(tabdialog,"configdlg",&newdefstruct); tabdialog->addTab(configdlg,i18n("Defaults")); tabdialog->addTab(about,i18n("About")); if(tabdialog->exec() == QDialog::Accepted){ kcalcdefaults.forecolor = newdefstruct.forecolor; kcalcdefaults.backcolor = newdefstruct.backcolor; kcalcdefaults.precision = newdefstruct.precision; kcalcdefaults.fixedprecision = newdefstruct.fixedprecision; kcalcdefaults.fixed = newdefstruct.fixed; kcalcdefaults.style = newdefstruct.style; kcalcdefaults.beep = newdefstruct.beep; set_colors(); set_precision(); set_style(); updateGeometry(); resize(minimumSize()); } delete configdlg; }