MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); if(initalized==false){ QPalette Pal(palette()); initalized=true; Pal.setColor(QPalette::Background, defaultcolor); ui->color_display->setAutoFillBackground(true); ui->color_display->setPalette(Pal); } //connect //display to control //QObject::connect(ui->AngleInput,SIGNAL(textChanged(QString)),ui->openGLWidget,SLOT(changeAngle(QString))); QObject::connect(ui->openGLWidget,SIGNAL(axiomRead(QString)),ui->Axiom,SLOT(setText(QString))); QObject::connect(ui->openGLWidget,SIGNAL(angleRead(QString)),ui->AngleInput,SLOT(setText(QString))); QObject::connect(ui->openGLWidget,SIGNAL(RuleRead(QString)),ui->RuleDIsplay,SLOT(setPlainText(QString))); QObject::connect(ui->openGLWidget,SIGNAL(iterationRead(int)),ui->Iteration_spinBox,SLOT(setValue(int))); QObject::connect(ui->openGLWidget,SIGNAL(RuleCalculated(QString)),ui->L_systemResult,SLOT(setPlainText(QString))); //control to display QObject::connect(ui->Axiom,SIGNAL(textEdited(QString)),ui->openGLWidget,SLOT(changeAxiom(QString))); QObject::connect(ui->AngleInput,SIGNAL(textEdited(QString)),ui->openGLWidget,SLOT(changeAngle(QString))); QObject::connect(ui->Iteration_spinBox,SIGNAL(valueChanged(int)),ui->openGLWidget,SLOT(changeIteration(int))); QObject::connect(ui->foceUpdateButton,SIGNAL(pressed()),ui->openGLWidget,SLOT(UpdateL_system())); QObject::connect(ui->FileSelector,SIGNAL(currentTextChanged(QString)),ui->openGLWidget,SLOT(ChangeTemplate(QString))); QObject::connect(ui->foceUpdateButton,SIGNAL(pressed()),ui->openGLWidget,SLOT(setFocus())); QObject::connect(this,SIGNAL(ColorChange(QColor)),ui->openGLWidget,SLOT(getChangedColor(QColor))); //this->setAttribute(Qt::WA_TranslucentBackground, true); }
void Canvas::setBgWhite() { QPalette Pal(palette()); Pal.setColor(QPalette::Background, Qt::white); setAutoFillBackground(true); setPalette(Pal); }
void Overlay::showEntry(MetaEntry* entry){ QWidget *box = new QWidget(this); // background color QPalette Pal(palette()); Pal.setColor(QPalette::Background, QColor(255, 255, 255, 30)); box->setAutoFillBackground(true); box->setPalette(Pal); // calculate size int w = this->size().width(), h = this->size().height(); int boxW = entry->width * w, boxH = entry->height * h, boxX = entry->left * w, boxY = entry->top * h; if(mouseX >= boxX && mouseX <= boxX+boxW) if(mouseY >= boxY && mouseY <= boxY+boxH){ box->setGeometry(boxX, boxY, boxW, boxH); box->show(); } boxes[entry] = box; //printf("Show %d\n", entry->itemId); //printf("box %d %d %d %d\n", boxX, boxY, boxW, boxH); }
MessageViewItem::MessageViewItem(MessageItem *data, QWidget *parent) : itemData(data), QWidget(parent), ui(new Ui::MessageViewItem) { setVisible(false); ui->setupUi(this); // set black background QPalette Pal(palette()); //Pal.setColor(QPalette::Background, palette().color(QPalette::AlternateBase)); setAutoFillBackground(true); setPalette(Pal); MessageEventFilter * filter = new MessageEventFilter(parent); installEventFilter(filter); ui->textEdit->setText(data->getText()); ui->textEdit->setReadOnly(true); backgroundColor = palette().color(QPalette::Background); setContextMenuPolicy(Qt::CustomContextMenu); connect(this,SIGNAL(customContextMenuRequested(QPoint)),parent,SLOT(on_customContextMenuRequested(QPoint))); connect(ui->textEdit,SIGNAL(focusOut()), parent, SLOT(on_dataChanged())); ui->listView->setModel(itemData->getVideoModel()); if(!itemData->getVideoModel()->rowCount() > 0) ui->listView->hide(); }
BottomBar::BottomBar(QWidget *parent) : QTabWidget(parent) { this->parent = (MainWindow*)parent; //console textArea = new QTextEdit(); QFont font; font.setFamily("Courier"); font.setStyleHint(QFont::Monospace); font.setFixedPitch(true); font.setPointSize(10); textArea->setFont(font); textArea->setReadOnly(true); this->addTab(textArea, "Console"); //errorlist errorList = new QListWidget(); this->addTab(errorList, "Errors"); //tabwidget QPalette Pal(palette()); Pal.setColor(QPalette::Background, "#323232"); setAutoFillBackground(true); setPalette(Pal); setStyleSheet("QTextEdit, QListWidget { color: white; background-color: #2D2D2F; border-style: solid; border-width: 1px; border-color: black; } QTabWidget::pane { background-color: #2D2D2F; } QTabBar::tab { color: white; background-color: #2D2D2F; border-style: solid; border-width: 1px; border-color: black; padding: 3px;} QTabBar::tab:selected { background-color: black; }"); connect(errorList, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(errorListItemDoubleClicked(QListWidgetItem*))); connect(this, SIGNAL(stdOut(QString)), this, SLOT(onStdOut(QString))); createRedirector(); }
void MainWindow::setButtonNormal(QPushButton* button) { QPalette Pal(palette()); Pal.setColor(QPalette::Button, Pal.color(QPalette::Button)); button->setAutoFillBackground(true); button->setPalette(Pal); }
MusicLocalSongSearch::MusicLocalSongSearch(QWidget *parent) : QDialog(parent) { setWindowFlags(Qt::FramelessWindowHint); resize(330, 35); QPalette Pal(palette()); Pal.setColor(QPalette::Background,QColor(176, 196, 222)); setAutoFillBackground(true); setPalette(Pal); m_showIcon = new QLabel(this); m_searchLine = new MusicLocalSongSearchEdit(this); m_closeButton = new QToolButton(this); m_showIcon->setGeometry(5, 5, 25, 25); m_showIcon->setStyleSheet(MusicUIObject::MCustomStyle05); m_searchLine->setGeometry(30, 5, 295, 25); m_closeButton->setGeometry(303, 5, 25, 25); m_closeButton->setStyleSheet(MusicUIObject::MCustomStyle06); m_closeButton->setCursor(QCursor(Qt::PointingHandCursor)); connect(m_closeButton, SIGNAL(clicked()), SLOT(close())); connect(m_searchLine, SIGNAL(cursorPositionChanged(int,int)), parent, SLOT(musicSearchIndexChanged(int,int))); }
ExerciseWindow::ExerciseWindow(QWidget *parent) : QWidget(parent), ui(new Ui::ExerciseWindow) { ui->setupUi(this); ui->scrollArea->setWidgetResizable(false); QPalette Pal(palette()); Pal.setColor(QPalette::Background, Qt::white); ui->scrollArea->setAutoFillBackground(true); ui->scrollArea->setPalette(Pal); openFromNewLine = ui->checkBox_newLine->isChecked(); srand((unsigned)time (0)); makeFlowChart(); QString name = windowTitle(); doc = QDomDocument("flowchart"); generateVars(); QDomElement domElement = doc.createElement(name); generateXML(domElement, doc); doc.appendChild(domElement); ui->textBrowser->setFont(QFont("Courier", 10)); ui->textBrowser_2->setFont(QFont("Courier", 10)); connect(ui->pushButton, SIGNAL(clicked()), SLOT(checkExercise())); connect(ui->checkBox_newLine, SIGNAL(clicked()), SLOT(checkExercise())); connect(ui->horizontalSlider, SIGNAL(valueChanged(int)), SLOT(changeFontSize(int))); connect(ui->checkBox, SIGNAL(toggled(bool)), wdg, SLOT(HideTexts(bool))); }
controlVW::controlVW(QWidget *parent) : QWidget(parent) { QGridLayout* mainLayout = new QGridLayout(); setLayout(mainLayout); setAutoFillBackground(true); // show(); QPalette Pal(palette()); // set black background Pal.setColor(QPalette::Background, Qt::black); setAutoFillBackground(true); setPalette(Pal); setMinimumSize(400, 400); qimage.load(":/images/pelota.png"); setMouseTracking(true); this->v = 0; this->w = 0; }
void ResourcePreview::setSelected(bool sel) { QPalette Pal(palette()); Pal.setColor(QPalette::Foreground, sel ? Qt::red : Qt::black); setPalette(Pal); }
Panel_Boutons::Panel_Boutons(QWidget *parent) : QWidget(parent) { QPalette Pal(palette()); Pal.setColor(QPalette::Background, Qt::red); setPalette(Pal); setAutoFillBackground(true); }
void MainWindow::setButtonActive(QPushButton* button) { QColor backgroundColour; backgroundColour.setNamedColor("red"); QPalette Pal(palette()); Pal.setColor(QPalette::Button, backgroundColour); button->setAutoFillBackground(true); button->setPalette(Pal); }
EventRecorderWidget::EventRecorderWidget(QWidget *parent) : QWidget(parent) { setGeometry(0,50,50,50); setFocusPolicy(Qt::ClickFocus); QPalette Pal(palette()); Pal.setColor(QPalette::Background, Qt::darkBlue); setAutoFillBackground(true); setPalette(Pal); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), bouncyPhysics(false), simulationPaused(false), gravityPhysics(true), simulationBorder(false), deltaT(TIMER_INTERVAL*3) { ui->setupUi(this); ui_bouncyToggle = findChild<QPushButton*>("bouncyToggle"); ui_pauseToggle = findChild<QPushButton*>("pauseToggle"); ui_gravityToggle = findChild<QPushButton*>("gravityToggle"); ui_borderToggle = findChild<QPushButton*>("borderToggle"); this->updateButtons(); // set black background QPalette Pal(palette()); Pal.setColor(QPalette::Background, Qt::black); this->setAutoFillBackground(true); this->setPalette(Pal); timerID = startTimer(TIMER_INTERVAL); //testing long double alfa = 0; long double v = 70; long double promien = 200; long double srodekX = 640; long double srodekY = 360; int NUMBER_OF_ORBS = 20; celestialBody cb; for (int i = 1; i <= NUMBER_OF_ORBS; i++) { cb.makePlanet(srodekX+cosl(alfa)*promien,srodekY+sinl(alfa)*promien); cb.setVelocity(sinl(alfa)*v,-cosl(alfa)*v); cbodies.push_back(cb); alfa+=2*M_PI/NUMBER_OF_ORBS; } alfa = 0; v = -30; promien = 100; srodekX = 640; srodekY = 360; NUMBER_OF_ORBS = 10; for (int i = 1; i <= NUMBER_OF_ORBS; i++) { cb.makePlanet(srodekX+cosl(alfa)*promien,srodekY+sinl(alfa)*promien); cb.setVelocity(sinl(alfa)*v,-cosl(alfa)*v); cb.setBrushColor(QColor(Qt::red)); cb.setPenColor(QColor(200,100,100)); cbodies.push_back(cb); alfa+=2*M_PI/NUMBER_OF_ORBS; } }
Pal CelFile::getPallette(std::string filename) { std::string palFilename; if(Misc::StringUtils::endsWith(filename, "l1.cel")) palFilename = Misc::StringUtils::replaceEnd("l1.cel", "l1.pal", filename); else palFilename = "levels/towndata/town.pal"; return Pal(palFilename); }
void QThemeWidget::setThemeColor(const QColor & value) { color = value; emit signalColorChanged(color); QPalette Pal(palette()); // set black background Pal.setColor(QPalette::Background, color); setAutoFillBackground(true); setPalette(Pal); }
SineWidget::SineWidget(QWidget *parent) : QWidget(parent) { QPalette Pal(palette()); // set black background Pal.setColor(QPalette::Background, Qt::white); setAutoFillBackground(true); setPalette(Pal); mDuty = 0.5; doRepaint = false; }
MainChoiceScreen::MainChoiceScreen( QSize appScrSize, Settings *settings, QWidget *parent): QWidget(parent) { init(); this->settings = settings; screenSize = appScrSize; backGroundColor = InterFace::getSkinColor(settings->skinColor()).head(); scaleFactorW = ((double)screenSize.width())/(double)defaultWidth; scaleFactorH = ((double)screenSize.height())/(double)defaultHeight; scaleFactor = qMin(scaleFactorW,scaleFactorH); setMinimumSize(screenSize); setMaximumSize(screenSize); setContentsMargins(0,0,0,0); QPalette Pal(palette()); Pal.setColor(QPalette::Background, backGroundColor); setAutoFillBackground(true); setPalette(Pal); iconSize = iconSize*scaleFactor; textSize = textSize*qSqrt(qSqrt(scaleFactor)); topOffset = topOffset*scaleFactor; okIconSize = okIconSize*scaleFactor; defTextSize = defTextSize*qSqrt(qSqrt(scaleFactor)); defTextLeftOffset = defTextLeftOffset*scaleFactor; QVBoxLayout *basicLayout = new QVBoxLayout(this); setLayout(basicLayout); basicLayout->setContentsMargins(0,0,0,0); gridWidget = new QWidget(); basicLayout->addSpacing(topOffset); basicLayout->addWidget(gridWidget); gridLayout = new QGridLayout(gridWidget); gridLayout->setContentsMargins(0,0,0,0); gridLayout->setSpacing(0); gridWidget->setLayout(gridLayout); basicLayout->addStretch(1); setGrpLst(); menuWidget = new Menu(screenSize,scaleFactor,settings,this); menuWidget->hide(); connect(menuWidget,SIGNAL(changeSettings(OPTIONS)),this,SLOT(onChangeSettings(OPTIONS))); }
void MainWindow::on_ColorSelector_clicked() { QColor colorcache=defaultcolor; defaultcolor=QColorDialog::getColor(defaultcolor, this); if(colorcache!=defaultcolor){ emit ColorChange(defaultcolor); } QPalette Pal(palette()); initalized=true; Pal.setColor(QPalette::Background, defaultcolor); ui->color_display->setAutoFillBackground(true); ui->color_display->setPalette(Pal); ui->openGLWidget->setFocus(); }
QWidget* CTimelineWidget::NewColumn(bool a_bIsGame) { QWidget* pNewColumn = new QWidget(this); QVBoxLayout* pVBLayout = new QVBoxLayout(pNewColumn); pVBLayout->setSpacing(6); pVBLayout->setContentsMargins(3, 3, 3, 3); pNewColumn->setLayout(pVBLayout); if (a_bIsGame) { QPalette Pal(palette()); Pal.setColor(QPalette::Background, QColor(255, 170, 0)); pNewColumn->setAutoFillBackground(true); pNewColumn->setPalette(Pal); } else { QPalette Pal(palette()); Pal.setColor(QPalette::Background, QColor(240, 240, 240)); pNewColumn->setAutoFillBackground(true); pNewColumn->setPalette(Pal); } return pNewColumn; }
Pal CelFile::getPallette(std::string filename) { std::string palFilename; if(Misc::StringUtils::startsWith(filename, "levels") && Misc::StringUtils::endsWith(filename, "l1.cel")) palFilename = Misc::StringUtils::replaceEnd("l1.cel", "l1.pal", filename); else if (Misc::StringUtils::startsWith(filename, "levels") && Misc::StringUtils::endsWith(filename, "l2.cel")) palFilename = Misc::StringUtils::replaceEnd("l2.cel", "l2.pal", filename); else if (Misc::StringUtils::startsWith(Misc::StringUtils::lowerCase(filename), "gendata")) palFilename = Misc::StringUtils::replaceEnd(".cel", ".pal", filename); else palFilename = "levels/towndata/town.pal"; return Pal(palFilename); }
SolWindow::SolWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::SolWindow) { ui->setupUi(this); // set green background QPalette Pal(palette()); QColor c(54,115,28); Pal.setColor(QPalette::Background, c); setAutoFillBackground(true); setPalette(Pal); }
ZedGraphControl::ZedGraphControl(QWidget *parent) : QWidget(parent) { QPalette Pal(palette()); this->resize(400,400); QRectF* rect = new QRectF( 0, 0, this->width(), this->height() ); this->_graphPane = new GraphPane(rect, "TITLE", "XAXIS", "YAXIS"); //Pal.setColor(QPalette::Background, Qt::white); this->setAutoFillBackground(true); this->setPalette(Pal); this->show(); }
void MainChoiceScreen::onChangeSettings(OPTIONS option) { switch (option) { case COLOR: backGroundColor = InterFace::getSkinColor(settings->skinColor()).head(); QPalette Pal(palette()); Pal.setColor(QPalette::Background, backGroundColor); setAutoFillBackground(true); setPalette(Pal); show(); break; } emit changeSettings(option); }
ComicFlowWidgetSW::ComicFlowWidgetSW(QWidget * parent) :ComicFlowWidget(parent) { flow = new ComicFlow(parent); connect(flow,SIGNAL(centerIndexChanged(int)),this,SIGNAL(centerIndexChanged(int))); connect(flow,SIGNAL(selected(unsigned int)),this,SIGNAL(selected(unsigned int))); QVBoxLayout * l = new QVBoxLayout; l->addWidget(flow); setLayout(l); //TODO eleminar "padding" QPalette Pal(palette()); // set black background Pal.setColor(QPalette::Background, Qt::black); setAutoFillBackground(true); setPalette(Pal); }
XModelGroup::XModelGroup(const QString& cap, QWidget * p) : QWidget(p), _nactions(0), _colCount(3) { //setStyleSheet("border: 1px solid gray;"); _mainLayout = new QGridLayout(this); _mainLayout->setHorizontalSpacing(2); _mainLayout->setVerticalSpacing(2); this->setLayout(_mainLayout); //add label QLabel * label = new QLabel(cap, this); _mainLayout->addWidget(label, 0, 0, 1, _colCount, Qt::AlignTop); QPalette Pal(palette()); Pal.setColor(QPalette::Background, QColor(220,220,220)); this->setAutoFillBackground(true); this->setPalette(Pal); }
void Menu::showMainMenu(bool showInAnyway) { if(!showInAnyway) if(menuExists) { menuExists=false; this->hide(); return; } menuExists=true; QWidget *menuWidget1 = new QWidget(); menuBasicLayout->replaceWidget(menuWidget,menuWidget1); delete(menuWidget); menuWidget = menuWidget1; QPalette Pal(menuWidget->palette()); Pal.setColor(QPalette::Background, backGroundColor); menuWidget->setAutoFillBackground(true); menuWidget->setPalette(Pal); menuLayout = new QVBoxLayout(); menuWidget->setLayout(menuLayout); QLabel *title = new QLabel(); title->setText(tr("НАСТРОЙКИ")); title->setFont(QFont("Calibri",menuTitleTxtSize)); title->setContentsMargins(10*scaleFactor,10*scaleFactor,0,0); title->setStyleSheet("color : "+titleColor+";"); title->setAlignment(Qt::AlignLeft|Qt::AlignTop); menuLayout->addWidget(title); menuLayout->addSpacing(10*scaleFactor); MenuItem *itemB; for(int i=0; i<mainMenuItemTxt.length(); i++) { itemB = new MenuItem(i,mainMenuItemTxt[i],menuItemTxtSize,10*scaleFactor, 20*scaleFactor); connect(itemB,SIGNAL(click(int)),this,SLOT(showSubMenu(int))); menuLayout->addWidget(itemB); } menuLayout->addStretch(1); this->show(); }
ButtonBar::ButtonBar(QWidget *parent) : QWidget(parent) { controller = new ButtonController(); QHBoxLayout *layout = new QHBoxLayout(); runButton = new QPushButton(); runButton->setText("Run"); runButton->setMaximumSize(50, 22); runButton->setMinimumSize(50, 22); QPixmap pix(":/Images/Images/RunButtonIcon.png"); QIcon icon(pix); runButton->setIcon(icon); runButton->setIconSize(pix.size()); buildButton = new QPushButton(); buildButton->setText("Build"); buildButton->setMaximumSize(50, 22); buildButton->setMinimumSize(50, 22); QPixmap pix2(":/Images/Images/BuildButtonIcon.png"); QIcon icon2(pix2); buildButton->setIcon(icon2); buildButton->setIconSize(pix2.size()); connect(runButton, SIGNAL(released()), this, SLOT(runButtonClicked())); connect(buildButton, SIGNAL(released()), this, SLOT(buildButtonClicked())); layout->addWidget(runButton); layout->addWidget(buildButton); layout->setContentsMargins(5, 5, 0, 5); layout->setAlignment(Qt::AlignLeft); setLayout(layout); QPalette Pal(palette()); Pal.setColor(QPalette::Background, "#323232"); setAutoFillBackground(true); setPalette(Pal); //background color for all buttons inside the buttonbar setStyleSheet("QPushButton { color: white; background-color: #2D2D2F; border: none; border-color: black; } QPushButton:hover{ background-color: #1E1E1F; } QPushButton:pressed{ border-left: 2px solid grey; border-top: 2px solid grey; border-right: 2px solid black; border-bottom: 2px solid black; }"); }
ResourcePreview::ResourcePreview(CaptureContext *c, IReplayOutput *output, QWidget *parent) : QFrame(parent), ui(new Ui::ResourcePreview) { ui->setupUi(this); CustomPaintWidget *thumb = new CustomPaintWidget(c, this); thumb->setOutput(output); thumb->setObjectName(ui->thumbnail->objectName()); thumb->setSizePolicy(ui->thumbnail->sizePolicy()); thumb->setMinimumSize(QSize(0, 0)); delete ui->thumbnail; ui->thumbnail = thumb; ui->gridLayout->addWidget(ui->thumbnail, 0, 0, 1, 2); QPalette Pal(ui->slotLabel->palette()); QWidget tmp; Pal.setColor(ui->slotLabel->foregroundRole(), tmp.palette().color(QPalette::Foreground)); Pal.setColor(ui->slotLabel->backgroundRole(), tmp.palette().color(QPalette::Dark)); ui->slotLabel->setAutoFillBackground(true); ui->slotLabel->setPalette(Pal); ui->descriptionLabel->setAutoFillBackground(true); ui->descriptionLabel->setPalette(Pal); QObject::connect(ui->thumbnail, &CustomPaintWidget::clicked, this, &ResourcePreview::clickEvent); QObject::connect(ui->slotLabel, &RDLabel::clicked, this, &ResourcePreview::clickEvent); QObject::connect(ui->descriptionLabel, &RDLabel::clicked, this, &ResourcePreview::clickEvent); QObject::connect(ui->thumbnail, &CustomPaintWidget::doubleClicked, this, &ResourcePreview::doubleClickEvent); QObject::connect(ui->slotLabel, &RDLabel::doubleClicked, this, &ResourcePreview::doubleClickEvent); QObject::connect(ui->descriptionLabel, &RDLabel::doubleClicked, this, &ResourcePreview::doubleClickEvent); }
// Create QELabel widgets in various flavours. void MainWindow::createQELabel() { // Create a QELabel QELabel* qel = new QELabel( centralWidget() ); // QELabel* qel = new QELabel( "OOE:ai", centralWidget() ); // See below for all the alternatives for setting a variable name // Set its position and size qel->setGeometry( 100, 30, 200, 30 ); // Display alarm state option 1. // Don't display the alarm state. This is done by setting the background colour and // we will be setting the background ourselves and don't want it overwritten // qel->setDisplayAlarmStateOption( standardProperties::DISPLAY_ALARM_STATE_NEVER ); // Display alarm state option 2. // Don't display the alarm state unless it is actually in alarm. // This is done by setting the background colour and // we will be setting the background ourselves and don't want it overwritten unless nessesary qel->setDisplayAlarmStateOption( standardProperties::DISPLAY_ALARM_STATE_WHEN_IN_ALARM ); // Display alarm state option 3. // Always display display the alarm state even when the current alarm state is 'No Alarm'. // This is done by setting the background colour which will make setting the background ourselves // (below) redundant. // qel->setDisplayAlarmStateOption( standardProperties::DISPLAY_ALARM_STATE_ALWAYS ); // Set the background to blue QPalette Pal(palette()); Pal.setColor(QPalette::Background, Qt::blue ); qel->setAutoFillBackground(true); qel->setPalette(Pal); //============================================================================================= // Set the variable name and establish a CA connection using one of the following alternatives: // Only one of the following alternatives should be uncommented. //============================================================================================= // Alternative 1. // Set the variable name using the access function for the variable name properties. // For a widget with only a single variable this is generally setVariableNameProperty(). // This will activate the widget using the variable name and the current macro substitutions. // Note, there is no variable index. QE widgets that take more than one variable name have a different // set and get property function for each variable. For example, QEImage has setVariableName0Property(), // setVariableName1Property(), etc. // CA connection is established for the resultant variable immedietly (unless called from within // designer when the connection is only established once the user has stopped typing for a short time). // Using setVariableNameProperty() and similar 'set variable name property' functions has the advantage // that only a single call is required to set the variable name and to establish the connection. // Macro substitutions should be set beforehand if required using setVariableNameSubstitutionsProperty(). // Calling setVariableNameSubstitutionsProperty() later works but an inapropriate connection // without macro substitutions will be attempted first. /* qel->setVariableNameSubstitutionsProperty( "P=OOE" ); qel->setVariableNameProperty( "$(P):ai" ); */ //============================================================================================= // Alterntive 2. // Set the variable name and substitutions. // CA connection is established for the resultant variable immedietly. // Using this alternative has the advantage of setting the variable name and macro substitutions, // and establishing a CA connection, in a single call. qel->setVariableNameAndSubstitutions( "$(P):ai", "P=OOE", 0 ); //============================================================================================= // Alternative 3. // Set the variable name and substitutions seperately, then once variable names are resolved // establish a CA connection using activate(). // Note, the calls to setVariableNameSubstitutions() and setVariableName() can occur in any order and // setVariableNameSubstitutions() is optional. // Using this alternative has the advantage of seperating the tasks of dealing with macro substitutions, variable names, and establisghing CA connections. // Note, calling activate() does more than just establish a CA connection, it also asks the widget // to perform any tasks which should only be done once all other widgets have been created. For example, // calling activate() may notify other widgets about itself so activate() should only be called once all other widgets this widget may relate to are constructed. /* qel->setVariableNameSubstitutions( "P=OOE" ); qel->setVariableName( "$(P):ai", 0 ); qel->activate(); */ //============================================================================================= // Alternative 4. // !!!!! CURRENTLY this alternative is unavailable as establishConnection() is not public. Should this change? // Set the variable name and substitutions seperately, then once variable names are resolved // establish a CA connection using establishConnection(). // Note, the calls to setVariableNameSubstitutions() and setVariableName() can occur in any order and // setVariableNameSubstitutions() is optional. // Using this alternative has the advantage of seperating the tasks of dealing with macro substitutions, variable names, and establisghing CA connections. // Note, unlike activate() in alternative 3 calling establishConnection() only updates the // CA connection. /* qel->setVariableNameSubstitutions( "P=OOE" ); qel->setVariableName( "$(P):ai", 0 ); qel->establishConnection( 0 ); */ //============================================================================================= // Alternative 4. // Don't uncomment this here! If you want tp try it out, uncomment it above. // It is a different way to construct the label and is duplicated here for the sake of the narative. // When this constructor is used, the variable name is set and the widget is activated immedietly. // QELabel* qel = new QELabel( "OOE:ai", centralWidget() ); //============================================================================================= // Alternative 5. // In this simplistic example this alternative appears cumbersome. // This alternative is used when setting the properties is out of the control of the programmer. // For example, when loading a .ui file using Qt's UI loader. // When using the UI loader, the caller has no clue what widgets are being created, // what properties are being set, in what order, and when all properties have been set. // This alternative allows the establishment of a CA connection to be held off until it is // cirtain that all property set functions that are going to be called have been called. // QEForm uses this alternative when loading .ui files. // Flag we don't want immediate activation... /* ContainerProfile profile; bool oldDontActivateYet = profile.setDontActivateYet( true ); // Set the properties. Here we know exactly what we are setting, but when loading a .ui // file using Qt's UI loader, we don't know what properties are being set, or in what order... qel->setVariableNameProperty( "$(P):ai" ); qel->setVariableNameSubstitutionsProperty( "P=OOE" ); // Remove the flag and establish a CA connection... profile.setDontActivateYet( oldDontActivateYet ); qel->activate(); */ }