FontRequester::FontRequester(QWidget *parent) : QWidget(parent) { QSettings settings; settings.beginGroup(GeneralOptionsConfigGroup); bool Thorn = settings.value("use_thorn_style", true).toBool(); settings.endGroup(); // These buttons wanted white backgrounds. I'm not even bothering to try to // fix problems like this via the stylesheet anymore. It would probably // just have unintended side effects and lead to tail chasing anyway. QString localStyle("QPushButton::enabled { border: 1px solid #AAAAAA; border-radius: 3px; background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 #999999, stop:1 #DDDDDD); color: #000000; padding: 0 5px 0 5px; } QPushButton::!enabled { border: 1px solid #808080; border-radius: 3px; background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 #999999, stop:1 #DDDDDD); color: #000000; padding: 0 5px 0 5px; } QPushButton:hover { border: 1px solid #AAAAAA; border-radius: 3px; background-color: #CCDFFF; color: #000000; } QPushButton::checked, QPushButton::pressed { border: 1px solid #E0E0E0; border-radius: 3px; background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 #E0E0E0, stop:1 #EEEEEE); }"); QGridLayout *layout = new QGridLayout(); setLayout(layout); m_label = new QLabel(); m_label->setFrameStyle(QFrame::Panel | QFrame::Sunken); m_label->setLineWidth(2); layout->addWidget(m_label, 0, 0); QPushButton *button = new QPushButton(tr("Choose...")); if (Thorn) button->setStyleSheet(localStyle); layout->addWidget(button, 0, 1); layout->setColumnStretch(0, 20); connect(button, SIGNAL(clicked()), this, SLOT(slotChoose())); }
InputDialog::InputDialog(const QString &title, const QString &label, QWidget *parent, QWidget *input, Qt::WindowFlags f) : QDialog(parent, f) { QSettings settings; settings.beginGroup(GeneralOptionsConfigGroup); bool Thorn = settings.value("use_thorn_style", true).toBool(); settings.endGroup(); QString localStyle("QDialog {background-color: #000000} QLabel{background-color: transparent; color: #FFFFFF}"); if (Thorn) setStyleSheet(localStyle); // set the window title setWindowTitle(tr("Rosegarden")); QVBoxLayout *vboxLayout = new QVBoxLayout(this); QLabel *t = new QLabel(QString("<qt><h3>%1</h3></qt>").arg(title)); vboxLayout->addWidget(t); // add the passed label to our layout /* QLabel *lbl = new QLabel(label, this); vboxLayout->addWidget(lbl); vboxLayout->addStretch(1);*/ // make a group box to hold the controls, for visual consistency with other // dialogs QGroupBox *gbox = new QGroupBox(this); vboxLayout->addWidget(gbox); QVBoxLayout *gboxLayout = new QVBoxLayout; gbox->setLayout(gboxLayout); gboxLayout->addWidget(new QLabel(label)); // add the passed input widget to our layout, and reparent it input->setParent(this); gboxLayout->addWidget(input); gboxLayout->addStretch(1); // I have no idea what this is for, but Qt had it, so we'll keep it in our // doctored version // lbl->setBuddy(input); // Put some clicky buttons and hook them up QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel, Qt::Horizontal, this); QPushButton *okButton = static_cast<QPushButton *>(buttonBox->addButton(QDialogButtonBox::Ok)); okButton->setDefault(true); vboxLayout->addWidget(buttonBox); QObject::connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); QObject::connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); // No size grip. Size grips are stupid looking, and I detest them. // Rosegarden has a NO SIZE GRIP policy. setSizeGripEnabled(false); }
IconStackedWidget::IconStackedWidget(QWidget *parent) : QWidget(parent), m_buttonHeight(0), m_buttonWidth(0), m_backgroundColor(QColor(255,255,255)) { // Use a frame widget for the icon panel, it will hold a bunch of buttons m_iconPanel = new QFrame(this); m_iconPanel->setFrameStyle(QFrame::Panel | QFrame::Sunken); m_iconPanel->setLineWidth(2); // Since this code was born with hard coded colors anyway, and since we live // in a stylesheet world now, let's dump the original QPalette // implementation in favor of a spot stylesheet. (I've never gotten // QPalette backgrounds to play nice with stylesheets elsewhere, and this is // probably the best solution anyway.) QString localStyle("background-color: #FFFFFF; color: #000000;"); m_iconPanel->setStyleSheet(localStyle); // Use a VBoxLayout for the icon buttons m_iconLayout = new QVBoxLayout; // Buttons butt up against each other m_iconLayout->setSpacing(0); // No margin between buttons and their frame m_iconLayout->setContentsMargins(0,0,0,0); // Want the widget fixed to the top of the space // A stretch item must be at the bottom of the list // This approach changes the direction to from Bottom to Top // and adds a stretch item first in the list m_iconLayout->setDirection(QBoxLayout::BottomToTop); m_iconLayout->addStretch(1); m_iconPanel->setLayout(m_iconLayout); // Use a stacked widget for the pages so the selected on is displayed m_pagePanel = new QStackedWidget(this); // Use a QHBoxLayout for icon and page panels m_layout = new QHBoxLayout; m_layout->setMargin(0); // Add the icon and page panels to the main layout m_layout->addWidget(m_iconPanel); m_layout->addWidget(m_pagePanel); setLayout(m_layout); }