FENETRE::FENETRE():QWidget() { // QWidget::showMaximized (); // 1 : Créer le QTabWidget QTabWidget *onglets = new QTabWidget(this); onglets->setGeometry(30, 20, 240, 160); // 2 : Créer les pages, en utilisant un widget parent pour contenir chacune des pages QWidget *page1 = new QWidget; QWidget *page2 = new QWidget; QLabel *page3 = new QLabel; // Comme un QLabel est aussi un QWidget (il en hérite), on peut aussi s'en servir de page // 3 : Créer le contenu des pages de widgets // Page 1 QLineEdit *lineEdit = new QLineEdit("Entrez votre nom"); QPushButton *bouton1 = new QPushButton("Cliquez ici"); QPushButton *bouton2 = new QPushButton("Ou là..."); QVBoxLayout *vbox1 = new QVBoxLayout; vbox1->addWidget(lineEdit); vbox1->addWidget(bouton1); vbox1->addWidget(bouton2); page1->setLayout(vbox1); // Page 2 QProgressBar *progress = new QProgressBar; progress->setValue(50); QSlider *slider = new QSlider(Qt::Horizontal); QPushButton *bouton3 = new QPushButton("Valider"); QVBoxLayout *vbox2 = new QVBoxLayout; vbox2->addWidget(progress); vbox2->addWidget(slider); vbox2->addWidget(bouton3); page2->setLayout(vbox2); // Page 3 (je ne vais afficher qu'une image ici, pas besoin de layout) page3->setPixmap(QPixmap("icone.png")); page3->setAlignment(Qt::AlignCenter); // 4 : ajouter les onglets au QTabWidget, en indiquant la page qu'ils contiennent onglets->addTab(page1, "Coordonnées"); onglets->addTab(page2, "Progression"); onglets->addTab(page3, "Image"); }
Faq::Faq(QWidget *parent) : QDialog(parent) { /** Ajoute le titre de la fenetre */ setWindowTitle("FAQ"); /** Création d'un widget pour les onglets */ QTabWidget *Tab = new QTabWidget(this); Tab->setGeometry(30, 20, 770, 450); /** fixe la position et la taille du widget */ /** Création des labels ou le texte apparaitra */ QLabel *frenchText = new QLabel; QLabel *englishText = new QLabel; /** Insertion du texte en français */ frenchText->setText("<b><i>Comment utiliser Fluctu'Action ?</i></b><br /><br />" "Fluctu'Action est une application permettant de suivre en temps réel" " l'évolution des cotations, en recherchant dynamiquement<br /> les données sur" "http://www.forexpro.com.<br /><br /><br />" "<b><i>Pour qui est destiné Fluctu'Action ?</i></b><br /><br />" "Fluctu'Action a été crée pour tout utilisateur désirant suivre le cours des monnaies internationnales.<br /><br /><br />" "<b><i>Pourquoi Fluctu'Action ? </i></b><br /><br />" "Permettre un accès rapide et intuitif afin de ne plus perdre de temps.<br /><br /><br />" "<b><i>Comment utiliser Fluctu'Action ? </i></b><br /><br />" "Fluctu'Action est très simple d'utilisation. Pour pouvoir afficher le tableau de devise voulu," " il suffit de cliquer sur le couple<br /> de devise dans la barre de menu afin d'afficher les" " dernières données téléchargées.Pour pouvoir changer la source<br /> de récupération de données," " il vous faudra modifier l'adresse dans Aide->Configuration, indiquer l'adresse URL puis Valider. "); /** Insertion du texte en anglais */ englishText->setText("<b><i>What is Fluctu'Action ? </i></b><br /><br />" "Fluctu'Action is an application that follows up in real time" " the evolution of quotations by dynamically seeking data<br /> on " "http://www.forexpro.com.<br /><br /><br />" "<b><i>Who is it for ? </i></b><br /><br />" "It was created for any user wishing to follows up the internationnal market price.<br /><br /><br />" "<b><i>Why use it ? </i></b><br /><br />" "Allow quick and intuitive access saving time.<br /><br /><br />" "<b><i>How use it ? </i></b><br /><br />" "Fluctu'Action is very easy to use. To display the currency table," " Just click on the currency pair in the menu bar to display<br /> the last data downloaded." "To change the source data recovery, you need to modify the address in Help-> Configuration," " specify the<br /> URL and then validate."); /** Ajoute les textes dans le widget des onglets */ Tab->addTab(frenchText, "Français"); Tab->addTab(englishText, "English"); }
MaFenetre::MaFenetre() : QWidget() { setFixedSize(300, 300); m_but = new QPushButton("Quitter", this); m_but->move(200,250); m_regles = new QPushButton("Regle du jeu", this); m_regles->move(90,200); QTabWidget *onglet = new QTabWidget(this); onglet->setGeometry(30, 20, 240, 160); InfoJoueur = new QWidget; Jouer= new QWidget; //Jouer m_2j= new QPushButton("Partie 2 joueurs"); QVBoxLayout *vbox1 = new QVBoxLayout; vbox1->addWidget(m_2j); Jouer->setLayout(vbox1); //Jouer //Info Joueur enregistrer= new QPushButton("Enregistrer"); PseudoJoueur = new QLineEdit("Entrez votre pseudo"); QVBoxLayout *vbox2 = new QVBoxLayout; vbox2->addWidget(PseudoJoueur); vbox2->addWidget(enregistrer); InfoJoueur->setLayout(vbox2); //Info Joueur onglet->addTab(InfoJoueur, "Info"); onglet->addTab(Jouer, "Jouer"); QObject::connect(m_regles, SIGNAL(clicked()), this, SLOT(monAction())); QObject::connect(m_but, SIGNAL(clicked()), qApp, SLOT(quit())); QObject::connect(PseudoJoueur, SIGNAL(selectionChanged()), this, SLOT(enleverText())); QObject::connect(m_2j, SIGNAL(clicked()), this, SLOT(afficherJeux2j())); QObject::connect(enregistrer, SIGNAL(clicked()), this, SLOT(enregistrerPseudo())); }
void model_import_dlg::create_model_tab(QString title, render::lod lod) { QWidget * tab = new QWidget(ui.tabModels); QTabWidget * tabHost = new QTabWidget(tab); tabHost->setGeometry(-1, 10, 590, 620); tabHost->setObjectName("meshTabHost"); QObject::connect(tabHost, SIGNAL(tabBarClicked(int)), this, SLOT(on_mesh_tab_changed(int))); for (size_t i = 0; i < conv.count(); i++) { model_import_dlg::create_mesh_tab(tabHost, i, lod); } ui.tabModels->addTab(tab, "Model " + title); }
void Dialog::ouvrirAbout() { QDialog *APropos = new QDialog(this, Qt::WindowCloseButtonHint); APropos->setFixedSize(300, 200); APropos->setWindowTitle("A Propos de QColor Slider RGB"); QTabWidget *tab = new QTabWidget(APropos); //QTABWIDGET incluant un QLabel et deux QTextEdit tab->setGeometry(5, 5, 290, 190); QLabel *infos = new QLabel(APropos); infos->setTextFormat(Qt::RichText); //format texte RTF infos->setText("<P><h3>QColor Slider RGB</h3></p><p>Créer par Pierre Leroux</p><p>Compilé le 12/01/2012<p><p>Version 1.0</p>"); infos->setAlignment(Qt::AlignCenter); QTextEdit *Alire = new QTextEdit(APropos); Alire->setText("Ce programme est fournit « EN L'ÉTAT », SANS GARANTIE D'AUCUNE SORTE, INCLUANT, SANS S'Y LIMITER, LES GARANTIES D'ABSENCE DE DÉFAUT, DE QUALITÉ MARCHANDE, D'ADÉQUATION À UN USAGE PARTICULIER."); Alire->setReadOnly(true); QTextEdit *licence = new QTextEdit(APropos); licence->setText("<p>This program is free software: you can redistribute it and/or modify" "it under the terms of the GNU General Public License as published by" "the Free Software Foundation, either version 3 of the License, or" "(at your option) any later version." "This program is distributed in the hope that it will be useful," "but WITHOUT ANY WARRANTY; without even the implied warranty of" "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" "GNU General Public License for more details." "You should have received a copy of the GNU General Public License" "along with this program. If not, see http://www.gnu.org/licenses/.</p>"); licence->setReadOnly(true); tab->addTab(infos, "Information"); tab->addTab(Alire, "A lire"); tab->addTab(licence, "GNU General Public License"); APropos->exec(); //ouverture de la fenetre }
void MainWindow::createWidgets() { setCentralWidget(new QWidget(this)); QVBoxLayout* mainFormBaseLayout = new QVBoxLayout(centralWidget(), 1, 1); QSplitter* splitter = new QSplitter(centralWidget()); splitter->setOrientation( Qt::Vertical ); mainFormBaseLayout->addWidget(splitter); m_tabEditor = new EditorTabWidget(splitter, this); splitter->setCollapsible(m_tabEditor, false); splitter->setOpaqueResize(true); QTabWidget* tabDebug = new QTabWidget(splitter); splitter->setCollapsible(tabDebug, false); tabDebug->setGeometry(0,0,0,height()/15); QWidget* globalVarTab = new QWidget(tabDebug); QVBoxLayout* globalVarTabLayout = new QVBoxLayout(globalVarTab, 1, 1); m_globaVarList = new VariablesListView(globalVarTab); globalVarTabLayout->addWidget(m_globaVarList); tabDebug->insertTab(globalVarTab, QString("Global")); QWidget* tabStack = new QWidget(tabDebug); QVBoxLayout* varTabLayout = new QVBoxLayout(tabStack, 1, 1); QHBoxLayout* stackComboLayout = new QHBoxLayout(0, 6, 6); QLabel* stackLabel = new QLabel(tabStack); stackLabel->setText(("Stack:")); stackLabel->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, stackLabel->sizePolicy().hasHeightForWidth())); stackComboLayout->addWidget(stackLabel); m_stackCombo = new DebuggerComboStack(tabStack); stackComboLayout->addWidget(m_stackCombo); varTabLayout->addLayout(stackComboLayout); m_localVarList= new VariablesListView(tabStack); varTabLayout->addWidget(m_localVarList); tabDebug->insertTab(tabStack, QString("Local")); QWidget* tabWatch = new QWidget(tabDebug); QVBoxLayout* watchTabLayout = new QVBoxLayout(tabWatch, 1, 1); QHBoxLayout* addWatchLayout = new QHBoxLayout(0, 6, 6); QLabel* addLabel = new QLabel(tabWatch); addLabel->setText(("Watch:")); addWatchLayout->addWidget(addLabel); m_edAddWatch = new KLineEdit(tabWatch); m_edAddWatch->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, m_edAddWatch->sizePolicy().hasHeightForWidth())); addWatchLayout->addWidget(m_edAddWatch); m_btAddWatch = new KPushButton(tabWatch); m_btAddWatch->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, m_btAddWatch->sizePolicy().hasHeightForWidth())); m_btAddWatch->setText(("Add")); addWatchLayout->addWidget(m_btAddWatch); QSpacerItem* spacer = new QSpacerItem(430, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); addWatchLayout->addItem(spacer); watchTabLayout->addLayout(addWatchLayout); m_watchList = new WatchListView(tabWatch); watchTabLayout->addWidget(m_watchList); tabDebug->insertTab(tabWatch, QString("Watch")); QWidget* breakpointTab = new QWidget(tabDebug); QVBoxLayout* breakpointTabLayout = new QVBoxLayout(breakpointTab, 1, 1); m_breakpointList = new BreakpointListView(breakpointTab); breakpointTabLayout->addWidget(m_breakpointList); tabDebug->insertTab(breakpointTab, QString("Breakpoints")); QWidget* logTab = new QWidget(tabDebug); QVBoxLayout* logTabLayout = new QVBoxLayout(logTab, 1, 1); m_logListView = new LogListView(logTab); logTabLayout->addWidget(m_logListView); tabDebug->insertTab(logTab, QString("Messages")); QWidget* outputTab = new QWidget(tabDebug); QVBoxLayout* outputTabLayout = new QVBoxLayout(outputTab, 1, 1); m_edOutput = new KTextEdit(outputTab); outputTabLayout->addWidget(m_edOutput); m_edOutput->setReadOnly(true); m_edOutput->setTextFormat(Qt::PlainText); m_edOutput->setPaper( QBrush(QColor("white"))); /* KTextEditor::Document* doc = KTextEditor::EditorChooser::createDocument( 0L, "KTextEditor::Document"); //doc->setReadWrite(false); m_edOutput = dynamic_cast<KTextEditor::EditInterface*>(doc); m_edOutput->setText("oioi"); outputTabLayout->addWidget(doc->createView(outputTab)); */ tabDebug->insertTab(outputTab, QString("Output")); }