ViewWindow::ViewWindow( Record::Server& server, QWidget* parent, Qt::WFlags flags ) : QMainWindow( parent, flags ) , server( server ) , pShow1x1( new QAction( QIcon( ":/icons/1x1.png" ), "1x1", this ) ) , pShow2x1( new QAction( QIcon( ":/icons/2x1.png" ), "2x1", this ) ) , pShow1x2( new QAction( QIcon( ":/icons/1x2.png" ), "1x2", this ) ) , pShow2x2( new QAction( QIcon( ":/icons/2x2.png" ), "2x2", this ) ) { QToolBar* toolbar = addToolBar( "View" ); toolbar->setMovable( false ); toolbar->addAction( pShow1x1 ); toolbar->addAction( pShow2x1 ); toolbar->addAction( pShow1x2 ); toolbar->addAction( pShow2x2 ); connect( pShow1x1, SIGNAL( triggered() ), this, SLOT( show1x1() ) ); connect( pShow2x1, SIGNAL( triggered() ), this, SLOT( show2x1() ) ); connect( pShow1x2, SIGNAL( triggered() ), this, SLOT( show1x2() ) ); connect( pShow2x2, SIGNAL( triggered() ), this, SLOT( show2x2() ) ); pShow1x1->setCheckable( true ); pShow2x1->setCheckable( true ); pShow1x2->setCheckable( true ); pShow2x2->setCheckable( true ); // ----------------------------------------------------------------- QToolButton* pAcquireButton = new QToolButton( toolbar ); QMenu* pAcquireMenu = new QMenu( pAcquireButton ); pAcquireButton->setMenu( pAcquireMenu ); pAcquireButton->setPopupMode( QToolButton::InstantPopup ); pAcquireButton->setText( "&Acquire" ); pAcquireButton->setMinimumHeight( 32 ); toolbar->setIconSize( QSize( 24, 24 ) ); toolbar->addSeparator(); toolbar->addWidget( pAcquireButton ); for( auto it = ComponentRegister::instance().factories.begin(); it != ComponentRegister::instance().factories.end(); ++it ) { ComponentLauncher* launcher = new ComponentLauncher( **it, *this, this ); pAcquireMenu->addAction( launcher->action ); } // ----------------------------------------------------------------- areaArray = new EmbedAreaArray(); this->setCentralWidget( areaArray ); // ----------------------------------------------------------------- componentWindowfactory.reset( new ViewWindowComponentWindowFactory( *this, *areaArray ) ); pShow1x1->trigger(); }
PaletteBox::PaletteBox(QWidget* parent) : QDockWidget(tr("Palettes"), parent) { setContextMenuPolicy(Qt::ActionsContextMenu); setObjectName("palette-box"); setAllowedAreas(Qt::DockWidgetAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea)); QAction* a = new QAction(this); a->setText(tr("Single Palette")); a->setCheckable(true); a->setChecked(preferences.singlePalette); addAction(a); connect(a, SIGNAL(toggled(bool)), SLOT(setSinglePalette(bool))); QWidget* w = new QWidget(this); w->setContextMenuPolicy(Qt::NoContextMenu); QVBoxLayout* vl = new QVBoxLayout(w); vl->setMargin(0); QHBoxLayout* hl = new QHBoxLayout; hl->setContentsMargins(5,5,5,0); workspaceList = new QComboBox; workspaceList->setToolTip(tr("Select workspace")); updateWorkspaces(); hl->addWidget(workspaceList); QToolButton* nb = new QToolButton; nb->setMinimumHeight(27); nb->setText(tr("+")); nb->setToolTip(tr("Add new workspace")); hl->addWidget(nb); setWidget(w); PaletteBoxScrollArea* sa = new PaletteBoxScrollArea; sa->setFocusPolicy(Qt::NoFocus); sa->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); sa->setContextMenuPolicy(Qt::CustomContextMenu); sa->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); sa->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); sa->setWidgetResizable(true); sa->setFrameShape(QFrame::NoFrame); vl->addWidget(sa); vl->addLayout(hl); QWidget* paletteList = new QWidget; sa->setWidget(paletteList); vbox = new QVBoxLayout; paletteList->setLayout(vbox); vbox->setMargin(0); vbox->setSpacing(1); vbox->addStretch(); paletteList->show(); connect(nb, SIGNAL(clicked()), SLOT(newWorkspaceClicked())); connect(workspaceList, SIGNAL(activated(int)), SLOT(workspaceSelected(int))); }
QToolButton* AppearanceDialog::selectButton(int width, int height, QString toolTip) { QToolButton* button = new QToolButton(this); button->setToolTip(toolTip); button->setToolButtonStyle(Qt::ToolButtonTextOnly); button->setMenu(new QMenu(button)); button->setMinimumWidth(width); button->setMinimumHeight(height); return button; }
QWidget * createWidget (QWidget * pParent) { QToolButton * pToolButton = new QToolButton(pParent); pToolButton->setToolButtonStyle(Qt::ToolButtonTextOnly); pToolButton->setPopupMode(QToolButton::InstantPopup); pToolButton->setMinimumHeight(TOOLBAR_MIN_HEIGHT); pToolButton->setMinimumWidth(100); QMenu * pMenu = new QMenu(pToolButton); pMenu->addMenu(tr("Textured")); pMenu->addMenu(tr("Wireframe")); pMenu->addMenu(tr("Tex-Wir")); pToolButton->setMenu(pMenu); return pToolButton; }
QWidget * createWidget (QWidget * pParent) { QToolButton * pToolButton = new QToolButton(pParent); pToolButton->setToolButtonStyle(Qt::ToolButtonTextOnly); pToolButton->setPopupMode(QToolButton::InstantPopup); pToolButton->setMinimumHeight(TOOLBAR_MIN_HEIGHT); pToolButton->setMinimumWidth(80); QMenu * pMenu = new QMenu(pToolButton); pMenu->addMenu(tr("RGB")); pMenu->addMenu(tr("Alpha")); pMenu->addMenu(tr("Overdraw")); pMenu->addMenu(tr("Mipmaps")); pToolButton->setMenu(pMenu); return pToolButton; }
void DistroMesas::on_mui_nuevapantalla_clicked() { bool ok; QString text = QInputDialog::getText(this, tr("QInputDialog::getText()"), tr("Nombre Pantalla:"), QLineEdit::Normal, "", &ok); if (ok && !text.isEmpty()) m_listapantallas.append(text); QToolButton *but = new QToolButton(this); but->setObjectName("p_" + text); but->setText(text); but->setCheckable(TRUE); but->setMinimumHeight(42); but->setMinimumWidth(42); mui_espaciopantallas->addWidget(but); connect(but, SIGNAL(clicked()), this, SLOT(cambiarPantalla())); repaint(); }
// FolderPage FolderPage::FolderPage(QWidget * parent) : QWizardPage(parent) { setTitle(tr("Alias Selection")); QGridLayout *grLayout = new QGridLayout(); QLabel * lblAlias = new QLabel(tr("You should specify an alias for Maverick Poker Bot in this step. Memorize the selected alias, you will need it while using Maverick Poker Bot. You can specify the alias yourself or you can use the \"Random\" button for the installation wizard to offer you some random value."), this); lblAlias->setWordWrap(true); edtAlias_ = new QLineEdit(this); edtAlias_->setValidator(new QRegExpValidator(QRegExp("[a-zA-Z0-9 ]+"), this)); edtAlias_->setAlignment(Qt::AlignCenter); QFont fn = edtAlias_->font(); fn.setBold(true); fn.setPointSize(24); edtAlias_->setFont(fn); edtAlias_->setMaxLength(120); connect(edtAlias_, SIGNAL(textChanged(const QString &)), this, SLOT(aliased(const QString &))); //QLabel * lbl = new QLabel(tr("Select the folder where you would like Holdem Folder to be installed, then click Next.<p>The program requires at least 10 MB of disk space."), this); //lbl->setWordWrap(true); QLabel * lblPath = new QLabel(tr("&Path to Maverick Poker Bot:"), this); lePath_ = new QLineEdit(this); lePath_->setText("C:\\Program Files\\"); lePath_->setEnabled(false); lblPath->setBuddy(lePath_); folderPrefix_ = "C:\\Program Files\\"; QToolButton * btnRandom = new QToolButton(this); btnRandom->setIcon(QIcon(":/images/dice.png")); btnRandom->setText(tr("&Random")); btnRandom->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); QPushButton * btnBrowse = new QPushButton(tr("&Browse..."), this); //btnBrowse->setFixedSize(20, 20); connect(btnBrowse, SIGNAL(clicked()), this, SLOT(browseDir())); connect(btnRandom, SIGNAL(clicked()), this, SLOT(random())); btnRandom->setMinimumHeight(edtAlias_->sizeHint().height()); btnRandom->setMinimumWidth(btnBrowse->sizeHint().width()); btnRandom->setIconSize(QSize(32, 32)); int row = 0; //grLayout->addWidget(lbl, row++, 0, 1, 2); //grLayout->addItem(new QSpacerItem(1, 20, // QSizePolicy::Fixed, QSizePolicy::Fixed), row++, 0, 1, 2); grLayout->addWidget(lblAlias, row++, 0, 1, 1); grLayout->addWidget(edtAlias_, row, 0, 1, 1); grLayout->addWidget(btnRandom, row++, 1, 1, 1, Qt::AlignCenter); grLayout->addItem(new QSpacerItem(1, 20, QSizePolicy::Fixed, QSizePolicy::Fixed), row++, 0, 1, 2); grLayout->addWidget(lblPath, row++, 0, 1, 2); grLayout->addWidget(lePath_, row, 0, 1, 1); grLayout->addWidget(btnBrowse, row++, 1, 1, 1, Qt::AlignRight); setLayout(grLayout); }
void DistroMesas::importXML(const QString val) { QFile file ( g_confpr->value( CONF_DIR_USER ) + "distromesas_" + mainCompany()->dbName() + ".cfn" ); if (file.exists()) { if ( !file.open ( QIODevice::ReadOnly ) ) { return; } // end if QString result (file.readAll()); file.close(); QDomDocument doc ( "mydocument" ); if ( !doc.setContent ( result ) ) { return; } // end if QDomElement docElem = doc.documentElement(); QDomElement principal = docElem.firstChildElement ( "BACKGROUND" ); m_background = principal.text(); principal = docElem.firstChildElement ( "ESCALA" ); g_escala = principal.text().toInt(); QDomNodeList nodos = docElem.elementsByTagName ( "MESA" ); int i = 0; while (i < nodos.count() ) { QDomNode ventana = nodos.item ( i++ ); QDomElement e1 = ventana.toElement(); /// try to convert the node to an element. if ( !e1.isNull() ) { /// the node was really an element. QString nodoText = e1.text(); /// Pasamos el XML a texto para poder procesarlo como tal. QString result; QTextStream stream ( &result ); ventana.save(stream,5); Mesa *mesa = new Mesa((BtCompany *) mainCompany(), mui_widget); mesa->importXML(result); if (! m_listapantallas.contains(mesa->m_pantalla)) { if (m_pantallaactual == "") { m_pantallaactual = mesa->m_pantalla; } // end if m_listapantallas.append(mesa->m_pantalla); QToolButton *but = new QToolButton(this); but->setObjectName("p_"+mesa->m_pantalla); but->setText(mesa->m_pantalla); but->setMinimumHeight(42); but->setMinimumWidth(42); but->setCheckable(TRUE); mui_espaciopantallas->addWidget(but); connect(but, SIGNAL(clicked()), this, SLOT(cambiarPantalla())); } // end if if (mesa->m_pantalla == m_pantallaactual) mesa->show(); } // end if } // end while } // end if }