UIMJSelect::UIMJSelect( DJDesktopMahjongController *mjController, const MJCardsGroups& groups, QWidget * parent, Qt::WindowFlags f ) :QDialog( parent, f ) { setupUi(this); m_rows = new QButtonGroup(this); qreal scale = 0.5; for( MJCardsGroupsConstIterator groupsIt = groups.begin(); groupsIt != groups.end(); groupsIt++ ) { const MJCards& cards = *groupsIt; QList<QPixmap> pixmaps; for( MJCardsConstIterator cardsIt = cards.begin(); cardsIt != cards.end(); cardsIt++ ) { MJCard card = *cardsIt; QString resPath = mjController->cardResPath( card, DJDesktopMahjongController::Standing, 1 ); QSvgRenderer *renderer = mjController->cardRenderer( resPath ); if ( renderer ) { QPixmap pix = SvgRender2Pixmap( renderer ); pixmaps << pix; } } QPixmap conjointPix = CreateConjointPixmap( pixmaps ); ScalePixmap( conjointPix, scale ); QRadioButton *button = new QRadioButton; button->setIconSize( conjointPix.size() ); button->setIcon( conjointPix ); button->setChecked( true ); m_rows->addButton( button ); vboxLayout1->addWidget( button ); } }
Login::Login(QWidget *parent) : QWidget(parent), ui(new Ui::Login) { ui->setupUi(this); QIcon icon; icon.addFile(QString::fromUtf8(":image/icon.png"), QSize(), QIcon::Normal, QIcon::Off); this->setWindowIcon(icon); group = new QButtonGroup(this); QStringListModel * model = AdminDAO::getAdminDAOInstance()->getUsernames(); QString img = ":/users/0.jpg"; QRadioButton * tmpbutton = ui->userButton_0; for (int i = 0; i < model->rowCount(); i++) { img = QString(":/users/%1.jpg").arg(i); switch (i) { case 0: tmpbutton = ui->userButton_0; break; case 1: tmpbutton = ui->userButton_1; break; case 2: tmpbutton = ui->userButton_2; break; case 3: tmpbutton = ui->userButton_3; break; case 4: tmpbutton = ui->userButton_4; break; case 5: tmpbutton = ui->userButton_5; break; default: tmpbutton = ui->userButton_0; break; } tmpbutton->setIcon(QPixmap(img)); tmpbutton->setIconSize(QSize(40,40)); } group->addButton(ui->userButton_0); group->addButton(ui->userButton_1); group->addButton(ui->userButton_2); group->addButton(ui->userButton_3); group->addButton(ui->userButton_4); group->addButton(ui->userButton_5); group->setId(ui->userButton_0, 0); group->setId(ui->userButton_1, 1); group->setId(ui->userButton_2, 2); group->setId(ui->userButton_3, 3); group->setId(ui->userButton_4, 4); group->setId(ui->userButton_5, 5); connect(ui->userButton_0, SIGNAL(clicked()), this, SLOT(sellectOneUser())); connect(ui->userButton_1, SIGNAL(clicked()), this, SLOT(sellectOneUser())); connect(ui->userButton_2, SIGNAL(clicked()), this, SLOT(sellectOneUser())); connect(ui->userButton_3, SIGNAL(clicked()), this, SLOT(sellectOneUser())); connect(ui->userButton_4, SIGNAL(clicked()), this, SLOT(sellectOneUser())); connect(ui->userButton_5, SIGNAL(clicked()), this, SLOT(sellectOneUser())); }
bool HandlerChoiceDialog::AddCommon (const IInfo *ii, const QString& addedAs) { QString name; QString tooltip; QIcon icon; try { name = ii->GetName (); tooltip = ii->GetInfo (); icon = ii->GetIcon (); } catch (const std::exception& e) { qWarning () << Q_FUNC_INFO << "could not query" << e.what () << ii; return false; } catch (...) { qWarning () << Q_FUNC_INFO << "could not query" << ii; return false; } QRadioButton *but = new QRadioButton (name, this); but->setToolTip (tooltip); but->setIconSize (QSize (32, 32)); but->setIcon (icon); but->setProperty ("AddedAs", "IDownload"); but->setProperty ("PluginID", ii->GetUniqueID ()); if (Buttons_->buttons ().isEmpty ()) but->setChecked (true); Buttons_->addButton (but); Ui_.DownloadersLayout_->addWidget (but); Infos_ [name] = ii; Ui_.DownloadersLabel_->show (); if (Downloaders_.size () + Handlers_.size () == 1) populateLocationsBox (); return true; }
ScreenPositionWidget::ScreenPositionWidget(QWidget *parent) : QWidget(parent), mButtonGroup(new QButtonGroup(this)) { QHBoxLayout *mainLayout = new QHBoxLayout(); int screenCount = QApplication::desktop()->numScreens(); for(int screen=0;screen<screenCount;++screen) { QGroupBox *screenPositionGroupBox = new QGroupBox(tr("Screen %1").arg(screen+1)); QGridLayout *gridLayout = new QGridLayout(); gridLayout->setMargin(0); gridLayout->setSpacing(0); int i = 0; for(int column=0;column<3;++column) { for(int row=0;row<3;++row,++i) { QRadioButton *radioButton = new QRadioButton(this); radioButton->setIconSize(QSize(40, 40)); radioButton->setIcon(QIcon(QString(":/images/monitor_%1.png").arg(iconNames[row][column]))); mButtonGroup->addButton(radioButton, screen * 9 + i); mRadioButtons.append(radioButton); gridLayout->addWidget(radioButton, row, column, Qt::AlignCenter); } } screenPositionGroupBox->setLayout(gridLayout); mainLayout->addWidget(screenPositionGroupBox); } setLayout(mainLayout); }
void PathStrokeControls::createCommonControls(QWidget* parent) { m_capGroup = new QGroupBox(parent); m_capGroup->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); QRadioButton *flatCap = new QRadioButton(m_capGroup); QRadioButton *squareCap = new QRadioButton(m_capGroup); QRadioButton *roundCap = new QRadioButton(m_capGroup); m_capGroup->setTitle(tr("Cap Style")); flatCap->setText(tr("Flat")); squareCap->setText(tr("Square")); roundCap->setText(tr("Round")); flatCap->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); squareCap->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); roundCap->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); m_joinGroup = new QGroupBox(parent); m_joinGroup->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); QRadioButton *bevelJoin = new QRadioButton(m_joinGroup); QRadioButton *miterJoin = new QRadioButton(m_joinGroup); QRadioButton *roundJoin = new QRadioButton(m_joinGroup); m_joinGroup->setTitle(tr("Join Style")); bevelJoin->setText(tr("Bevel")); miterJoin->setText(tr("Miter")); roundJoin->setText(tr("Round")); m_styleGroup = new QGroupBox(parent); m_styleGroup->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); QRadioButton *solidLine = new QRadioButton(m_styleGroup); QRadioButton *dashLine = new QRadioButton(m_styleGroup); QRadioButton *dotLine = new QRadioButton(m_styleGroup); QRadioButton *dashDotLine = new QRadioButton(m_styleGroup); QRadioButton *dashDotDotLine = new QRadioButton(m_styleGroup); QRadioButton *customDashLine = new QRadioButton(m_styleGroup); m_styleGroup->setTitle(tr("Pen Style")); QPixmap line_solid(":res/images/line_solid.png"); solidLine->setIcon(line_solid); solidLine->setIconSize(line_solid.size()); QPixmap line_dashed(":res/images/line_dashed.png"); dashLine->setIcon(line_dashed); dashLine->setIconSize(line_dashed.size()); QPixmap line_dotted(":res/images/line_dotted.png"); dotLine->setIcon(line_dotted); dotLine->setIconSize(line_dotted.size()); QPixmap line_dash_dot(":res/images/line_dash_dot.png"); dashDotLine->setIcon(line_dash_dot); dashDotLine->setIconSize(line_dash_dot.size()); QPixmap line_dash_dot_dot(":res/images/line_dash_dot_dot.png"); dashDotDotLine->setIcon(line_dash_dot_dot); dashDotDotLine->setIconSize(line_dash_dot_dot.size()); customDashLine->setText(tr("Custom")); int fixedHeight = bevelJoin->sizeHint().height(); solidLine->setFixedHeight(fixedHeight); dashLine->setFixedHeight(fixedHeight); dotLine->setFixedHeight(fixedHeight); dashDotLine->setFixedHeight(fixedHeight); dashDotDotLine->setFixedHeight(fixedHeight); m_pathModeGroup = new QGroupBox(parent); m_pathModeGroup->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); QRadioButton *curveMode = new QRadioButton(m_pathModeGroup); QRadioButton *lineMode = new QRadioButton(m_pathModeGroup); m_pathModeGroup->setTitle(tr("Line Style")); curveMode->setText(tr("Curves")); lineMode->setText(tr("Lines")); // Layouts QVBoxLayout *capGroupLayout = new QVBoxLayout(m_capGroup); capGroupLayout->addWidget(flatCap); capGroupLayout->addWidget(squareCap); capGroupLayout->addWidget(roundCap); QVBoxLayout *joinGroupLayout = new QVBoxLayout(m_joinGroup); joinGroupLayout->addWidget(bevelJoin); joinGroupLayout->addWidget(miterJoin); joinGroupLayout->addWidget(roundJoin); QVBoxLayout *styleGroupLayout = new QVBoxLayout(m_styleGroup); styleGroupLayout->addWidget(solidLine); styleGroupLayout->addWidget(dashLine); styleGroupLayout->addWidget(dotLine); styleGroupLayout->addWidget(dashDotLine); styleGroupLayout->addWidget(dashDotDotLine); styleGroupLayout->addWidget(customDashLine); QVBoxLayout *pathModeGroupLayout = new QVBoxLayout(m_pathModeGroup); pathModeGroupLayout->addWidget(curveMode); pathModeGroupLayout->addWidget(lineMode); // Connections connect(flatCap, SIGNAL(clicked()), m_renderer, SLOT(setFlatCap())); connect(squareCap, SIGNAL(clicked()), m_renderer, SLOT(setSquareCap())); connect(roundCap, SIGNAL(clicked()), m_renderer, SLOT(setRoundCap())); connect(bevelJoin, SIGNAL(clicked()), m_renderer, SLOT(setBevelJoin())); connect(miterJoin, SIGNAL(clicked()), m_renderer, SLOT(setMiterJoin())); connect(roundJoin, SIGNAL(clicked()), m_renderer, SLOT(setRoundJoin())); connect(curveMode, SIGNAL(clicked()), m_renderer, SLOT(setCurveMode())); connect(lineMode, SIGNAL(clicked()), m_renderer, SLOT(setLineMode())); connect(solidLine, SIGNAL(clicked()), m_renderer, SLOT(setSolidLine())); connect(dashLine, SIGNAL(clicked()), m_renderer, SLOT(setDashLine())); connect(dotLine, SIGNAL(clicked()), m_renderer, SLOT(setDotLine())); connect(dashDotLine, SIGNAL(clicked()), m_renderer, SLOT(setDashDotLine())); connect(dashDotDotLine, SIGNAL(clicked()), m_renderer, SLOT(setDashDotDotLine())); connect(customDashLine, SIGNAL(clicked()), m_renderer, SLOT(setCustomDashLine())); // Set the defaults: flatCap->setChecked(true); bevelJoin->setChecked(true); curveMode->setChecked(true); solidLine->setChecked(true); }