void Window::createTextFormatsGroupBox() { /* QGroupBox *textFormatsGroupBox; QLabel *weekdayColorLabel; QLabel *weekendColorLabel; QLabel *headerTextFormatLabel; QComboBox *weekdayColorCombo; QComboBox *weekendColorCombo; QComboBox *headerTextFormatCombo; QCheckBox *firstFridayCheckBox; QCheckBox *mayFirstCheckBox; */ textFormatsGroupBox = new QGroupBox(tr("TextFormat")); weekdayColorCombo = createColorComboBox(); weekdayColorLabel = new QLabel(tr("WeekdayColor")); weekdayColorLabel->setBuddy(weekdayColorCombo); weekendColorCombo = createColorComboBox(); weekendColorLabel = new QLabel(tr("WeekendColor")); weekendColorLabel->setBuddy(weekendColorCombo); headerTextFormatCombo = new QComboBox; headerTextFormatCombo->addItem("Bold"); headerTextFormatCombo->addItem("Italic"); headerTextFormatCombo->addItem("Green"); headerTextFormatLabel = new QLabel(tr("HeaderTextFormat")); headerTextFormatLabel->setBuddy(headerTextFormatCombo); firstFridayCheckBox = new QCheckBox(tr("FirstFriday")); mayFirstCheckBox = new QCheckBox(tr("MayFirst")); connect(weekdayColorCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(weekdayFormatChanged())); connect(weekdayColorCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(reformatCalendarPage())); connect(weekendColorCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(weekendFormatChanged())); connect(weekendColorCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(reformatCalendarPage())); connect(headerTextFormatCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(reformatHeaders())); connect(firstFridayCheckBox, SIGNAL(toggled(bool)), this, SLOT(reformatCalendarPage())); connect(mayFirstCheckBox, SIGNAL(toggled(bool)), this, SLOT(reformatCalendarPage())); QHBoxLayout *hLayout = new QHBoxLayout; hLayout->addWidget(firstFridayCheckBox); hLayout->addStretch(); hLayout->addWidget(mayFirstCheckBox); QGridLayout *textLayout = new QGridLayout; textLayout->addWidget(weekdayColorLabel, 0, 0); textLayout->addWidget(weekdayColorCombo, 0, 1); textLayout->addWidget(weekendColorLabel, 1, 0); textLayout->addWidget(weekendColorCombo, 1, 1); textLayout->addWidget(headerTextFormatLabel, 2, 0); textLayout->addWidget(headerTextFormatCombo, 2, 1); textLayout->addLayout(hLayout, 3, 0, 1, 2); textFormatsGroupBox->setLayout(textLayout); }
void CalendarWidget::createTextFormatsGroupBox() { textFormatsGroupBox = new QGroupBox(tr("Text Formats")); weekdayColorCombo = createColorComboBox(); weekdayColorCombo->setCurrentIndex( weekdayColorCombo->findText(tr("Black"))); weekdayColorLabel = new QLabel(tr("&Weekday color:")); weekdayColorLabel->setBuddy(weekdayColorCombo); weekendColorCombo = createColorComboBox(); weekendColorCombo->setCurrentIndex( weekendColorCombo->findText(tr("Red"))); weekendColorLabel = new QLabel(tr("Week&end color:")); weekendColorLabel->setBuddy(weekendColorCombo); headerTextFormatCombo = new QComboBox; headerTextFormatCombo->addItem(tr("Bold")); headerTextFormatCombo->addItem(tr("Italic")); headerTextFormatCombo->addItem(tr("Plain")); headerTextFormatLabel = new QLabel(tr("&Header text:")); headerTextFormatLabel->setBuddy(headerTextFormatCombo); firstFridayCheckBox = new QCheckBox(tr("&First Friday in blue")); mayFirstCheckBox = new QCheckBox(tr("May &1 in red")); connect(weekdayColorCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(weekdayFormatChanged())); connect(weekendColorCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(weekendFormatChanged())); connect(headerTextFormatCombo, SIGNAL(currentIndexChanged(QString)), this, SLOT(reformatHeaders())); connect(firstFridayCheckBox, SIGNAL(toggled(bool)), this, SLOT(reformatCalendarPage())); connect(mayFirstCheckBox, SIGNAL(toggled(bool)), this, SLOT(reformatCalendarPage())); QHBoxLayout *checkBoxLayout = new QHBoxLayout; checkBoxLayout->addWidget(firstFridayCheckBox); checkBoxLayout->addStretch(); checkBoxLayout->addWidget(mayFirstCheckBox); QGridLayout *outerLayout = new QGridLayout; outerLayout->addWidget(weekdayColorLabel, 0, 0); outerLayout->addWidget(weekdayColorCombo, 0, 1); outerLayout->addWidget(weekendColorLabel, 1, 0); outerLayout->addWidget(weekendColorCombo, 1, 1); outerLayout->addWidget(headerTextFormatLabel, 2, 0); outerLayout->addWidget(headerTextFormatCombo, 2, 1); outerLayout->addLayout(checkBoxLayout, 3, 0, 1, 2); textFormatsGroupBox->setLayout(outerLayout); weekdayFormatChanged(); weekendFormatChanged(); reformatHeaders(); reformatCalendarPage(); }