DrumrollEditor::DrumrollEditor(QWidget* parent) : QMainWindow(parent) { setObjectName("Drumroll"); setWindowTitle(QString("MuseScore")); // setIconSize(QSize(preferences.iconWidth, preferences.iconHeight)); QWidget* mainWidget = new QWidget; QGridLayout* layout = new QGridLayout; mainWidget->setLayout(layout); layout->setSpacing(0); QToolBar* tb = addToolBar(tr("Toolbar 1")); tb->addAction(getAction("undo")); tb->addAction(getAction("redo")); tb->addSeparator(); #ifdef HAS_MIDI tb->addAction(getAction("midi-on")); #endif QAction* a = getAction("follow"); a->setCheckable(true); a->setChecked(preferences.followSong); tb->addAction(a); tb->addSeparator(); tb->addAction(getAction("rewind")); tb->addAction(getAction("play")); tb->addSeparator(); //------------- tb = addToolBar(tr("Toolbar 3")); layout->addWidget(tb, 1, 0, 1, 2); for (int i = 0; i < VOICES; ++i) { QToolButton* b = new QToolButton(this); b->setToolButtonStyle(Qt::ToolButtonTextOnly); QPalette p(b->palette()); p.setColor(QPalette::Base, MScore::selectColor[i]); b->setPalette(p); QAction* a = getAction(voiceActions[i]); b->setDefaultAction(a); tb->addWidget(b); } tb->addSeparator(); tb->addWidget(new QLabel(tr("Cursor:"))); pos = new Awl::PosLabel; tb->addWidget(pos); Awl::PitchLabel* pl = new Awl::PitchLabel(); tb->addWidget(pl); tb->addSeparator(); tb->addWidget(new QLabel(tr("Velocity:"))); veloType = new QComboBox; veloType->addItem(tr("offset"), int(Note::ValueType::OFFSET_VAL)); veloType->addItem(tr("user"), int(Note::ValueType::USER_VAL)); tb->addWidget(veloType); velocity = new QSpinBox; velocity->setRange(-1, 127); velocity->setSpecialValueText("--"); velocity->setReadOnly(true); tb->addWidget(velocity); tb->addWidget(new QLabel(tr("Pitch:"))); pitch = new Awl::PitchEdit; pitch->setReadOnly(true); tb->addWidget(pitch); double xmag = .1; gv = new DrumView; gv->scale(xmag, 1.0); layout->addWidget(gv, 3, 1); ruler = new Ruler; ruler->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); ruler->setFixedHeight(rulerHeight); ruler->setMag(xmag, 1.0); layout->addWidget(ruler, 2, 1); Piano* piano = new Piano; piano->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); piano->setFixedWidth(pianoWidth); layout->addWidget(piano, 3, 0); setCentralWidget(mainWidget); connect(gv->verticalScrollBar(), SIGNAL(valueChanged(int)), piano, SLOT(setYpos(int))); connect(gv->horizontalScrollBar(), SIGNAL(valueChanged(int)), ruler, SLOT(setXpos(int))); connect(gv, SIGNAL(xposChanged(int)), ruler, SLOT(setXpos(int))); connect(gv, SIGNAL(magChanged(double,double)), ruler, SLOT(setMag(double,double))); connect(gv, SIGNAL(magChanged(double,double)), piano, SLOT(setMag(double,double))); connect(gv, SIGNAL(pitchChanged(int)), pl, SLOT(setPitch(int))); connect(gv, SIGNAL(pitchChanged(int)), piano, SLOT(setPitch(int))); connect(piano, SIGNAL(pitchChanged(int)), pl, SLOT(setPitch(int))); connect(gv, SIGNAL(posChanged(const Pos&)), pos, SLOT(setValue(const Pos&))); connect(gv, SIGNAL(posChanged(const Pos&)), ruler, SLOT(setPos(const Pos&))); connect(ruler, SIGNAL(posChanged(const Pos&)), pos, SLOT(setValue(const Pos&))); connect(ruler, SIGNAL(locatorMoved(int)), SLOT(moveLocator(int))); connect(veloType, SIGNAL(activated(int)), SLOT(veloTypeChanged(int))); connect(velocity, SIGNAL(valueChanged(int)), SLOT(velocityChanged(int))); connect(gv->scene(), SIGNAL(selectionChanged()), SLOT(selectionChanged())); connect(piano, SIGNAL(keyPressed(int)), SLOT(keyPressed(int))); connect(piano, SIGNAL(keyReleased(int)), SLOT(keyReleased(int))); resize(800, 400); QActionGroup* ag = new QActionGroup(this); a = new QAction(this); a->setData("delete"); a->setShortcut(Qt::Key_Delete); ag->addAction(a); addActions(ag->actions()); connect(ag, SIGNAL(triggered(QAction*)), SLOT(cmd(QAction*))); readSettings(); }
MainWindow::MainWindow(QWidget *parent) :QMainWindow(parent) { showMaximized(); setWindowTitle("TDLAS"); customPlot=new QCustomPlot(); customPlot->setInteractions(QCP::iRangeDrag|QCP::iRangeZoom); customPlot->axisRect()->insetLayout()->setInsetAlignment(0, Qt::AlignTop|Qt::AlignCenter); customPlot_gas=new QCustomPlot(); customPlot_gas->setInteractions(QCP::iRangeDrag|QCP::iRangeZoom); PB_start=new QPushButton("开始"); PB_stop=new QPushButton("中止"); PB_quit=new QPushButton("退出"); PB_stop->setEnabled(false); LB_signalLength=new QLabel("输入信号长度:"); LB_firLength=new QLabel("FIR滤波器长度:"); LB_spendTime=new QLabel("信号处理耗时(s):"); LB_maxPos=new QLabel("最大峰值:"); LB_status=new QLabel("状态:"); countLabel=new QLabel("计数:"); LB_signalLength_value=new QLabel(); LB_firLength_value=new QLabel(); LB_spendTime_value=new QLabel(); LB_maxPos_value=new QLabel(); LB_status_value=new QLabel(); countLabel_value=new QLabel(); CB_mode=new QCheckBox("Raw Mode"); modeCombo=new QComboBox(); modeCombo->addItem("包络"); modeCombo->addItem("CO"); modeCombo->addItem("CO2"); modeCombo->addItem("C2H2"); //工具栏 QToolBar *toolBar=new QToolBar(this); toolBar->setMovable(false); addToolBar(Qt::TopToolBarArea,toolBar); toolBar->addSeparator(); toolBar->addSeparator(); toolBar->addWidget(modeCombo); toolBar->addSeparator(); toolBar->addWidget(CB_mode); toolBar->addSeparator(); toolBar->addWidget(PB_start); toolBar->addSeparator(); toolBar->addWidget(PB_stop); toolBar->addSeparator(); toolBar->addWidget(PB_quit); QGroupBox *groupBox=new QGroupBox(); QGridLayout *grid=new QGridLayout(groupBox); grid->addWidget(LB_signalLength,0,0); grid->addWidget(LB_firLength,1,0); grid->addWidget(LB_spendTime,2,0); grid->addWidget(LB_maxPos,3,0); grid->addWidget(LB_status,4,0); grid->addWidget(LB_signalLength_value,0,1); grid->addWidget(LB_firLength_value,1,1); grid->addWidget(LB_spendTime_value,2,1); grid->addWidget(LB_maxPos_value,3,1); grid->addWidget(LB_status_value,4,1); grid->addWidget(countLabel,5,0); grid->addWidget(countLabel_value,5,1); QVBoxLayout *vLayout=new QVBoxLayout(); vLayout->addWidget(customPlot,1); vLayout->addWidget(customPlot_gas,1); //布局类 QWidget *mainW=new QWidget(this); setCentralWidget(mainW); QHBoxLayout *layout=new QHBoxLayout(mainW); layout->addWidget(groupBox,1); layout->addLayout(vLayout,5); connect(PB_quit,SIGNAL(clicked()),this,SLOT(PB_quit_clicked())); connect(PB_start,SIGNAL(clicked()),this,SLOT(PB_start_clicked())); connect(PB_stop,SIGNAL(clicked()),this,SLOT(PB_stop_clicked())); connect(modeCombo,SIGNAL(currentIndexChanged(int)),this,SLOT(modeCombo_indexChanged(int))); //成员变量 END_LENGTH=END_100003; _mode=MODE_VALUE_1; myCom=NULL; myCom = new Posix_QextSerialPort("/dev/ttyAMA0",QextSerialBase::Polling); myCom->setBaudRate(BAUD9600); myCom->setDataBits(DATA_8); myCom->setParity(PAR_NONE); myCom->setStopBits(STOP_1); myCom->setFlowControl(FLOW_OFF); myCom->setTimeout(10); timer=new QTimer(this); connect(timer,SIGNAL(timeout()),this,SLOT(readMyCom())); timer->setInterval(500); thread=new Thread(this); connect(thread,SIGNAL(checkCorrect(Msg*)),this,SLOT(spi_recvOver(Msg*))); connect(thread,SIGNAL(checkCorrect120003(Msg*)),this,SLOT(spi_recvOver120003(Msg*))); isTransing=true; thread->start(); }
MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent) : QMainWindow(parent) , m_bookmarkWidget(0) , m_filterCombo(0) , m_toolBarMenu(0) , m_cmdLine(cmdLine) , m_progressWidget(0) , m_qtDocInstaller(0) , m_connectedInitSignals(false) { TRACE_OBJ setToolButtonStyle(Qt::ToolButtonFollowStyle); setDockOptions(dockOptions() | AllowNestedDocks); QString collectionFile; if (usesDefaultCollection()) { MainWindow::collectionFileDirectory(true); collectionFile = MainWindow::defaultHelpCollectionFileName(); } else { collectionFile = cmdLine->collectionFile(); } HelpEngineWrapper &helpEngineWrapper = HelpEngineWrapper::instance(collectionFile); BookmarkManager *bookMarkManager = BookmarkManager::instance(); if (!initHelpDB(!cmdLine->collectionFileGiven())) { qDebug("Fatal error: Help engine initialization failed. " "Error message was: %s\nAssistant will now exit.", qPrintable(HelpEngineWrapper::instance().error())); std::exit(1); } m_centralWidget = new CentralWidget(this); setCentralWidget(m_centralWidget); m_indexWindow = new IndexWindow(this); QDockWidget *indexDock = new QDockWidget(tr("Index"), this); indexDock->setObjectName(QLatin1String("IndexWindow")); indexDock->setWidget(m_indexWindow); addDockWidget(Qt::LeftDockWidgetArea, indexDock); m_contentWindow = new ContentWindow; QDockWidget *contentDock = new QDockWidget(tr("Contents"), this); contentDock->setObjectName(QLatin1String("ContentWindow")); contentDock->setWidget(m_contentWindow); addDockWidget(Qt::LeftDockWidgetArea, contentDock); m_searchWindow = new SearchWidget(helpEngineWrapper.searchEngine()); m_searchWindow->setFont(!helpEngineWrapper.usesBrowserFont() ? qApp->font() : helpEngineWrapper.browserFont()); QDockWidget *searchDock = new QDockWidget(tr("Search"), this); searchDock->setObjectName(QLatin1String("SearchWindow")); searchDock->setWidget(m_searchWindow); addDockWidget(Qt::LeftDockWidgetArea, searchDock); QDockWidget *bookmarkDock = new QDockWidget(tr("Bookmarks"), this); bookmarkDock->setObjectName(QLatin1String("BookmarkWindow")); bookmarkDock->setWidget(m_bookmarkWidget = bookMarkManager->bookmarkDockWidget()); addDockWidget(Qt::LeftDockWidgetArea, bookmarkDock); QDockWidget *openPagesDock = new QDockWidget(tr("Open Pages"), this); openPagesDock->setObjectName(QLatin1String("Open Pages")); OpenPagesManager *openPagesManager = OpenPagesManager::createInstance(this, usesDefaultCollection(), m_cmdLine->url()); openPagesDock->setWidget(openPagesManager->openPagesWidget()); addDockWidget(Qt::LeftDockWidgetArea, openPagesDock); connect(m_centralWidget, SIGNAL(addBookmark(QString,QString)), bookMarkManager, SLOT(addBookmark(QString,QString))); connect(bookMarkManager, SIGNAL(escapePressed()), this, SLOT(activateCurrentCentralWidgetTab())); connect(bookMarkManager, SIGNAL(setSource(QUrl)), m_centralWidget, SLOT(setSource(QUrl))); connect(bookMarkManager, SIGNAL(setSourceInNewTab(QUrl)), openPagesManager, SLOT(createPage(QUrl))); QHelpSearchEngine *searchEngine = helpEngineWrapper.searchEngine(); connect(searchEngine, SIGNAL(indexingStarted()), this, SLOT(indexingStarted())); connect(searchEngine, SIGNAL(indexingFinished()), this, SLOT(indexingFinished())); QString defWindowTitle = tr("Qt Assistant"); setWindowTitle(defWindowTitle); setupActions(); statusBar()->show(); m_centralWidget->connectTabBar(); setupFilterToolbar(); setupAddressToolbar(); const QString windowTitle = helpEngineWrapper.windowTitle(); setWindowTitle(windowTitle.isEmpty() ? defWindowTitle : windowTitle); QByteArray iconArray = helpEngineWrapper.applicationIcon(); if (iconArray.size() > 0) { QBuffer buffer(&iconArray); QImageReader reader(&buffer); QIcon appIcon; do { QPixmap pix; pix.convertFromImage(reader.read()); appIcon.addPixmap(pix); } while (reader.jumpToNextImage()); qApp->setWindowIcon(appIcon); } else { QIcon appIcon(QLatin1String(":/qt-project.org/assistant/images/assistant-128.png")); qApp->setWindowIcon(appIcon); } QToolBar *toolBar = addToolBar(tr("Bookmark Toolbar")); toolBar->setObjectName(QLatin1String("Bookmark Toolbar")); bookMarkManager->setBookmarksToolbar(toolBar); toolBar->hide(); toolBarMenu()->addAction(toolBar->toggleViewAction()); QByteArray ba(helpEngineWrapper.mainWindow()); if (!ba.isEmpty()) restoreState(ba); ba = helpEngineWrapper.mainWindowGeometry(); if (!ba.isEmpty()) { restoreGeometry(ba); } else { tabifyDockWidget(contentDock, indexDock); tabifyDockWidget(indexDock, bookmarkDock); tabifyDockWidget(bookmarkDock, searchDock); contentDock->raise(); const QRect screen = QApplication::desktop()->screenGeometry(); resize(4*screen.width()/5, 4*screen.height()/5); adjustSize(); // make sure we won't start outside of the screen move(screen.center() - rect().center()); } if (!helpEngineWrapper.hasFontSettings()) { helpEngineWrapper.setUseAppFont(false); helpEngineWrapper.setUseBrowserFont(false); helpEngineWrapper.setAppFont(qApp->font()); helpEngineWrapper.setAppWritingSystem(QFontDatabase::Latin); helpEngineWrapper.setBrowserFont(qApp->font()); helpEngineWrapper.setBrowserWritingSystem(QFontDatabase::Latin); } else { updateApplicationFont(); } updateAboutMenuText(); QTimer::singleShot(0, this, SLOT(insertLastPages())); if (m_cmdLine->enableRemoteControl()) (void)new RemoteControl(this); if (m_cmdLine->contents() == CmdLineParser::Show) showContents(); else if (m_cmdLine->contents() == CmdLineParser::Hide) hideContents(); if (m_cmdLine->index() == CmdLineParser::Show) showIndex(); else if (m_cmdLine->index() == CmdLineParser::Hide) hideIndex(); if (m_cmdLine->bookmarks() == CmdLineParser::Show) showBookmarksDockWidget(); else if (m_cmdLine->bookmarks() == CmdLineParser::Hide) hideBookmarksDockWidget(); if (m_cmdLine->search() == CmdLineParser::Show) showSearch(); else if (m_cmdLine->search() == CmdLineParser::Hide) hideSearch(); if (m_cmdLine->contents() == CmdLineParser::Activate) showContents(); else if (m_cmdLine->index() == CmdLineParser::Activate) showIndex(); else if (m_cmdLine->bookmarks() == CmdLineParser::Activate) showBookmarksDockWidget(); if (!m_cmdLine->currentFilter().isEmpty()) { const QString &curFilter = m_cmdLine->currentFilter(); if (helpEngineWrapper.customFilters().contains(curFilter)) helpEngineWrapper.setCurrentFilter(curFilter); } if (usesDefaultCollection()) QTimer::singleShot(0, this, SLOT(lookForNewQtDocumentation())); else checkInitState(); connect(&helpEngineWrapper, SIGNAL(documentationRemoved(QString)), this, SLOT(documentationRemoved(QString))); connect(&helpEngineWrapper, SIGNAL(documentationUpdated(QString)), this, SLOT(documentationUpdated(QString))); setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North); GlobalActions::instance()->updateActions(); if (helpEngineWrapper.addressBarEnabled()) showNewAddress(); }
XSettingsWindow::XSettingsWindow(const qutim_sdk_0_3::SettingsItemList& settings, QObject* controller, QWidget *parent) : QMainWindow(parent), p(new XSettingsWindowPrivate) { setAttribute(Qt::WA_DeleteOnClose); p->controller = controller; setWindowModality(controller ? Qt::WindowModal : Qt::NonModal); //setup ui QWidget *widget = new QWidget(this); QVBoxLayout *l = new QVBoxLayout(widget); Config cfg; cfg.beginGroup("xsettings/window"); QByteArray data; p->parent = qobject_cast<XSettingsWindow*>(qApp->activeWindow()); if(p->parent) { QRect geom = p->parent->geometry(); int width = geom.width()/15; int height = geom.height()/15; geom.adjust(width,height,-width,-height); setGeometry(geom); } else { data = cfg.value("geometry", QByteArray()); if (data.isEmpty() || !restoreGeometry(data)) { QSize desktopSize = QApplication::desktop()->availableGeometry(QCursor::pos()).size(); resize(desktopSize.width() / 2, desktopSize.height() * 2 / 3); centerizeWidget(this); } } //init widgets p->splitter = new QSplitter(Qt::Horizontal,widget); p->listWidget = new QListWidget(widget); p->stackedWidget = new QStackedWidget(widget); //default widget QWidget *empty = new QWidget(this); p->stackedWidget->addWidget(empty); p->splitter->addWidget(p->listWidget); p->splitter->addWidget(p->stackedWidget); data = cfg.value("splitterState", QByteArray()); if (data.isEmpty() || !p->splitter->restoreState(data)) p->splitter->setSizes(QList<int>() << 80 << 250); l->addWidget(p->splitter); QDialogButtonBox::StandardButtons buttons; if (controller) buttons = QDialogButtonBox::Ok; else buttons = QDialogButtonBox::Save | QDialogButtonBox::Cancel; p->buttonBox = new QDialogButtonBox(buttons, Qt::Horizontal, widget); l->addWidget(p->buttonBox); p->buttonBox->setVisible(controller); //init actiontoolbar setCentralWidget(widget); setUnifiedTitleAndToolBarOnMac(true); p->toolBar = new ActionToolBar(widget); addToolBar(Qt::TopToolBarArea,p->toolBar); int width = style()->pixelMetric(QStyle::PM_IconViewIconSize); QSize size = QSize(width, width); p->toolBar->setIconSize(size); p->toolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); p->toolBar->setObjectName(QLatin1String("SettingsBar")); p->toolBar->setMovable(false); #if defined (Q_OS_WIN32) || defined(Q_OS_MAC) width = 22; #else width = style()->pixelMetric(QStyle::PM_ToolBarIconSize); #endif size = QSize(width, width); p->listWidget->setIconSize(size); p->group = new QActionGroup(widget); p->group->setExclusive(true); //connections connect(p->group,SIGNAL(triggered(QAction*)), SLOT(onGroupActionTriggered(QAction*))); connect(p->listWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), SLOT(onCurrentItemChanged(QListWidgetItem*)) ); connect(p->buttonBox,SIGNAL(accepted()), SLOT(save())); connect(p->buttonBox,SIGNAL(rejected()), SLOT(cancel())); loadSettings(settings); if (p->group->actions().count()) p->group->actions().first()->trigger(); }
ConfigDialog::ConfigDialog(QDir _home, Zones *_zones, Context *context) : home(_home), zones(_zones), context(context) { setAttribute(Qt::WA_DeleteOnClose); #ifdef Q_OS_MAC QToolBar *head = addToolBar(tr("Preferences")); setFixedSize(525,540); setUnifiedTitleAndToolBarOnMac(true); #else QToolBar *head = addToolBar(tr("Options")); head->setMovable(false); // oops! setFixedSize(530,580); #endif // icons static QIcon generalIcon(QPixmap(":images/toolbar/GeneralPreferences.png")); static QIcon athleteIcon(QPixmap(":/images/toolbar/user.png")); static QIcon passwordIcon(QPixmap(":/images/toolbar/passwords.png")); static QIcon appearanceIcon(QPixmap(":/images/toolbar/color.png")); static QIcon dataIcon(QPixmap(":/images/toolbar/data.png")); static QIcon metricsIcon(QPixmap(":/images/toolbar/abacus.png")); static QIcon devicesIcon(QPixmap(":/images/devices/kickr.png")); // Setup the signal mapping so the right config // widget is displayed when the icon is clicked QSignalMapper *iconMapper = new QSignalMapper(this); // maps each option connect(iconMapper, SIGNAL(mapped(int)), this, SLOT(changePage(int))); head->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); QAction *added; // General settings added = head->addAction(generalIcon, tr("General")); connect(added, SIGNAL(triggered()), iconMapper, SLOT(map())); iconMapper->setMapping(added, 0); added =head->addAction(athleteIcon, tr("Athlete")); connect(added, SIGNAL(triggered()), iconMapper, SLOT(map())); iconMapper->setMapping(added, 1); added =head->addAction(passwordIcon, tr("Passwords")); connect(added, SIGNAL(triggered()), iconMapper, SLOT(map())); iconMapper->setMapping(added, 2); added =head->addAction(appearanceIcon, tr("Appearance")); connect(added, SIGNAL(triggered()), iconMapper, SLOT(map())); iconMapper->setMapping(added, 3); added =head->addAction(dataIcon, tr("Data Fields")); connect(added, SIGNAL(triggered()), iconMapper, SLOT(map())); iconMapper->setMapping(added, 4); added =head->addAction(metricsIcon, tr("Metrics")); connect(added, SIGNAL(triggered()), iconMapper, SLOT(map())); iconMapper->setMapping(added, 5); added =head->addAction(devicesIcon, tr("Train Devices")); connect(added, SIGNAL(triggered()), iconMapper, SLOT(map())); iconMapper->setMapping(added, 6); pagesWidget = new QStackedWidget(this); // create those config pages general = new GeneralConfig(_home, _zones, context); pagesWidget->addWidget(general); athlete = new AthleteConfig(_home, _zones, context); pagesWidget->addWidget(athlete); password = new PasswordConfig(_home, _zones, context); pagesWidget->addWidget(password); appearance = new AppearanceConfig(_home, _zones, context); pagesWidget->addWidget(appearance); data = new DataConfig(_home, _zones, context); pagesWidget->addWidget(data); metric = new MetricConfig(_home, _zones, context); pagesWidget->addWidget(metric); device = new DeviceConfig(_home, _zones, context); pagesWidget->addWidget(device); closeButton = new QPushButton(tr("Close")); saveButton = new QPushButton(tr("Save")); QHBoxLayout *horizontalLayout = new QHBoxLayout; horizontalLayout->addWidget(pagesWidget, 1); QHBoxLayout *buttonsLayout = new QHBoxLayout; buttonsLayout->addStretch(); buttonsLayout->setSpacing(5); buttonsLayout->addWidget(closeButton); buttonsLayout->addWidget(saveButton); QWidget *contents = new QWidget(this); setCentralWidget(contents); contents->setContentsMargins(0,0,0,0); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addLayout(horizontalLayout); mainLayout->addStretch(); mainLayout->addLayout(buttonsLayout); mainLayout->setSpacing(0); contents->setLayout(mainLayout); // We go fixed width to ensure a consistent layout for // tabs, sub-tabs and internal widgets and lists #ifdef Q_OS_MACX setWindowTitle(tr("Preferences")); #else setWindowTitle(tr("Options")); #endif connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); connect(saveButton, SIGNAL(clicked()), this, SLOT(saveClicked())); }
mainWidget::mainWidget(const char *name) : KTMainWindow(name) { md = new mainDlg(this); md->init(); QPopupMenu *file = new QPopupMenu; CHECK_PTR( file ); file->insertItem(i18n("&Save"), md, SLOT(save()) ); file->insertSeparator(); file->insertItem(i18n("&Preferences..."), md, SLOT(properties()) ); file->insertSeparator(); file->insertItem(i18n("&Quit"), md, SLOT(quit()) ); QPopupMenu *user = new QPopupMenu; CHECK_PTR(user); user->insertItem(i18n("&Edit..."), md, SLOT(useredit()) ); user->insertItem(i18n("&Delete..."), md, SLOT(userdel()) ); user->insertItem(i18n("&Add..."), md, SLOT(useradd()) ); user->insertItem(i18n("&Set password..."), md, SLOT(setpwd()) ); QPopupMenu *group = new QPopupMenu; CHECK_PTR(group); group->insertItem(i18n("&Edit..."), md, SLOT(grpedit()) ); group->insertItem(i18n("&Delete..."), md, SLOT(grpdel()) ); group->insertItem(i18n("&Add..."), md, SLOT(grpadd()) ); QString tmp; tmp.sprintf(i18n("KUser version %s\n" "KDE project\n" "This program was created by\n" "Denis Pershin\n" "[email protected]\n" "Copyright 1997(c)"), _KU_VERSION); QPopupMenu *help = kapp->getHelpMenu(true, tmp); menubar = new KMenuBar( this ); CHECK_PTR( menubar ); menubar->insertItem(i18n("&File"), file ); menubar->insertItem(i18n("&User"), user ); menubar->insertItem(i18n("&Group"), group ); menubar->insertSeparator(); menubar->insertItem(i18n("&Help"), help ); setMenu(menubar); toolbar = new KToolBar(this, "toolbar"); QPixmap pix; pix = kapp->getIconLoader()->loadIcon("useradd.xpm"); toolbar->insertButton(pix, 0, SIGNAL(clicked()), md, SLOT(useradd()), TRUE, i18n("Add user")); pix = kapp->getIconLoader()->loadIcon("userdel.xpm"); toolbar->insertButton(pix, 0, SIGNAL(clicked()), md, SLOT(userdel()), TRUE, i18n("Delete user")); pix = kapp->getIconLoader()->loadIcon("useredit.xpm"); toolbar->insertButton(pix, 0, SIGNAL(clicked()), md, SLOT(useredit()), TRUE, i18n("Edit user")); toolbar->insertSeparator(); pix = kapp->getIconLoader()->loadIcon("grpadd.xpm"); toolbar->insertButton(pix, 0, SIGNAL(clicked()), md, SLOT(grpadd()), TRUE, i18n("Add group")); pix = kapp->getIconLoader()->loadIcon("grpdel.xpm"); toolbar->insertButton(pix, 0, SIGNAL(clicked()), md, SLOT(grpdel()), TRUE, i18n("Delete group")); pix = kapp->getIconLoader()->loadIcon("grpedit.xpm"); toolbar->insertButton(pix, 0, SIGNAL(clicked()), md, SLOT(grpedit()), TRUE, i18n("Edit group")); toolbar->setBarPos(KToolBar::Top); addToolBar(toolbar); sbar = new KStatusBar(this); sbar->insertItem("Reading config", 0); setStatusBar(sbar); setView(md); resize(500, 400); // restore geometry settings KConfig *config = KApplication::getKApplication()->getConfig(); config->setGroup( "Appearance" ); QString geom = config->readEntry( "Geometry" ); if (!geom.isEmpty()) { int width, height; sscanf( geom, "%dx%d", &width, &height ); resize( width, height ); } sbar->changeItem(i18n("Ready"), 0); }
Window::Window(QWidget* parent): QMainWindow(parent) { setObjectName("PlanetScannerWindow"); QToolBar* toolbar = new QToolBar(this); toolbar->setIconSize(QSize(24, 24)); toolbar->setFloatable(false); toolbar->setContextMenuPolicy(Qt::PreventContextMenu); addToolBar(toolbar); QAction* refreshAction = toolbar->addAction(QIcon(":/icons/refresh.png"), "Refresh"); connect(refreshAction, SIGNAL(triggered()), this, SLOT(refreshPlanets())); QAction* settingsAction = toolbar->addAction(QIcon(":/icons/settings.png"), "Settings"); connect(settingsAction, SIGNAL(triggered()), this, SLOT(showSettingsDialog())); planetTreeView = new QTreeView(this); planetTreeView->setMinimumHeight(10); planetTreeModel = new PlanetTreeModel(planetTreeView); planetTreeProxyModel = new PlanetTreeSortFilterProxyModel(planetTreeModel); planetTreeProxyModel->setSourceModel(planetTreeModel); planetTreeView->setModel(planetTreeProxyModel); planetTreeModel->setHorizontalHeaderLabels(QStringList() << "Hostname" << "Map" << "Gametype" << "Players" << "Address"); planetTreeView->setSortingEnabled(true); planetTreeView->sortByColumn(0, Qt::AscendingOrder); planetTreeView->setContextMenuPolicy(Qt::CustomContextMenu); planetTreeView->setSelectionMode(QAbstractItemView::SingleSelection); connect(planetTreeView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint))); QAction* connectAction = new QAction("Connect", planetTreeView); QAction* connectAsSpectatorAction = new QAction("Connect as spectator", planetTreeView); QAction* copyAction = new QAction("Copy", planetTreeView); QAction* openProfileAction = new QAction("Open profile in a browser", planetTreeView); connect(connectAction, SIGNAL(triggered()), this, SLOT(connectSelected())); connect(connectAsSpectatorAction, SIGNAL(triggered()), this, SLOT(connectAsSpectatorSelected())); connect(copyAction, SIGNAL(triggered()), this, SLOT(copySelected())); connect(openProfileAction, &QAction::triggered, this, &Window::openProfileSelected); gameContextMenu = new QMenu(planetTreeView); planetContextMenu = new QMenu(planetTreeView); registeredPlayerContextMenu = new QMenu(planetTreeView); unregisteredPlayerContextMenu = new QMenu(planetTreeView); gameContextMenu->addActions(QList<QAction*>() << connectAction << connectAsSpectatorAction << copyAction); planetContextMenu->addActions(QList<QAction*>() << copyAction); registeredPlayerContextMenu->addActions(QList<QAction*>() << openProfileAction << copyAction); unregisteredPlayerContextMenu->addActions(QList<QAction*>() << copyAction); setCentralWidget(planetTreeView); game = new QProcess(this); statistics = new StatisticsWebSite(this); connect(statistics, &StatisticsWebSite::playersInfoRecieved, this, &Window::processStatisticsPlayers); autoRefreshTimer = new QTimer(this); connect(autoRefreshTimer, SIGNAL(timeout()), this, SLOT(refreshPlanets())); contextMenuShown = false; Settings& settings = Settings::getInstance(); connect(&settings, &Settings::dataChanged, this, &Window::applyChangedSettings); settings.load(); applyChangedSettings(); ::Settings::loadWindow(this); refreshPlanets(); }
void MainWindow::setupUI() { QWidget * widget = new QWidget(); QFormLayout * layout = new QFormLayout(); widget->setLayout(layout); setCentralWidget(widget); // connect widget signals / slots connect(&xSpinBox_, SIGNAL(editingFinished()), this, SLOT(updateCoordinates())); connect(&ySpinBox_, SIGNAL(editingFinished()), this, SLOT(updateCoordinates())); connect(&widthSpinBox_, SIGNAL(editingFinished()), this, SLOT(updateCoordinates())); connect(&heightSpinBox_, SIGNAL(editingFinished()), this, SLOT(updateCoordinates())); connect(&retinaBox_, SIGNAL(released()), this, SLOT(updateCoordinates())); hostnameLineEdit_.setText( DEFAULT_HOST_ADDRESS ); char hostname[256] = {0}; gethostname( hostname, 256 ); uriLineEdit_.setText( hostname ); const int screen = -1; QRect desktopRect = QApplication::desktop()->screenGeometry( screen ); xSpinBox_.setRange(0, desktopRect.width()); ySpinBox_.setRange(0, desktopRect.height()); widthSpinBox_.setRange(1, desktopRect.width()); heightSpinBox_.setRange(1, desktopRect.height()); // default to full screen xSpinBox_.setValue(0); ySpinBox_.setValue(0); widthSpinBox_.setValue( desktopRect.width( )); heightSpinBox_.setValue( desktopRect.height( )); // call updateCoordinates() to commit coordinates from the UI updateCoordinates(); // frame rate limiting frameRateSpinBox_.setRange(1, 60); frameRateSpinBox_.setValue(24); // add widgets to UI layout->addRow("Hostname", &hostnameLineEdit_); layout->addRow("Stream name", &uriLineEdit_); layout->addRow("X", &xSpinBox_); layout->addRow("Y", &ySpinBox_); layout->addRow("Width", &widthSpinBox_); layout->addRow("Height", &heightSpinBox_); layout->addRow("Retina Display", &retinaBox_); layout->addRow("Max frame rate", &frameRateSpinBox_); layout->addRow("Actual frame rate", &frameRateLabel_); // share desktop action shareDesktopAction_ = new QAction("Share Desktop", this); shareDesktopAction_->setStatusTip("Share desktop"); shareDesktopAction_->setCheckable(true); shareDesktopAction_->setChecked(false); connect(shareDesktopAction_, SIGNAL(triggered(bool)), this, SLOT(shareDesktop(bool))); // Only user actions connect(this, SIGNAL(streaming(bool)), shareDesktopAction_, SLOT(setChecked(bool))); // show desktop selection window action showDesktopSelectionWindowAction_ = new QAction("Show Rectangle", this); showDesktopSelectionWindowAction_->setStatusTip("Show desktop selection rectangle"); showDesktopSelectionWindowAction_->setCheckable(true); showDesktopSelectionWindowAction_->setChecked(false); connect(showDesktopSelectionWindowAction_, SIGNAL(triggered(bool)), this, SLOT(showDesktopSelectionWindow(bool))); // Only user actions // create toolbar QToolBar * toolbar = addToolBar("toolbar"); // add buttons to toolbar toolbar->addAction(shareDesktopAction_); toolbar->addAction(showDesktopSelectionWindowAction_); // Update timer connect(&shareDesktopUpdateTimer_, SIGNAL(timeout()), this, SLOT(shareDesktopUpdate())); }
void TextEdit::setupFileActions() { QToolBar *tb = new QToolBar(this); tb->setWindowTitle(tr("File Actions")); addToolBar(tb); // QMenu *menu = new QMenu(tr("&File"), this); // menuBar()->addMenu(menu); QAction *a; QIcon newIcon = QIcon::fromTheme("document-new", QIcon(rsrcPath + "/filenew.png")); a = new QAction( newIcon, tr("&New"), this); a->setPriority(QAction::LowPriority); a->setShortcut(QKeySequence::New); connect(a, SIGNAL(triggered()), this, SLOT(fileNew())); tb->addAction(a); // menu->addAction(a); a = new QAction(QIcon::fromTheme("document-open", QIcon(rsrcPath + "/fileopen.png")), tr("&Open..."), this); a->setShortcut(QKeySequence::Open); connect(a, SIGNAL(triggered()), this, SLOT(fileOpen())); tb->addAction(a); // menu->addAction(a); // menu->addSeparator(); actionSave = a = new QAction(QIcon::fromTheme("document-save", QIcon(rsrcPath + "/filesave.png")), tr("&Save"), this); a->setShortcut(QKeySequence::Save); connect(a, SIGNAL(triggered()), this, SLOT(fileSave())); a->setEnabled(false); tb->addAction(a); // menu->addAction(a); a = new QAction(tr("Save &As..."), this); a->setPriority(QAction::LowPriority); connect(a, SIGNAL(triggered()), this, SLOT(fileSaveAs())); // menu->addAction(a); // menu->addSeparator(); #ifndef QT_NO_PRINTER a = new QAction(QIcon::fromTheme("document-print", QIcon(rsrcPath + "/fileprint.png")), tr("&Print..."), this); a->setPriority(QAction::LowPriority); a->setShortcut(QKeySequence::Print); connect(a, SIGNAL(triggered()), this, SLOT(filePrint())); tb->addAction(a); // menu->addAction(a); a = new QAction(QIcon::fromTheme("fileprint", QIcon(rsrcPath + "/fileprint.png")), tr("Print Preview..."), this); connect(a, SIGNAL(triggered()), this, SLOT(filePrintPreview())); // menu->addAction(a); a = new QAction(QIcon::fromTheme("exportpdf", QIcon(rsrcPath + "/exportpdf.png")), tr("&Export PDF..."), this); a->setPriority(QAction::LowPriority); a->setShortcut(Qt::CTRL + Qt::Key_D); connect(a, SIGNAL(triggered()), this, SLOT(filePrintPdf())); tb->addAction(a); // menu->addAction(a); // menu->addSeparator(); #endif a = new QAction(tr("&Quit"), this); a->setShortcut(Qt::CTRL + Qt::Key_Q); connect(a, SIGNAL(triggered()), this, SLOT(close())); // menu->addAction(a); }
void TextEdit::setupTextActions() { QToolBar *tb = new QToolBar(this); tb->setWindowTitle(tr("Format Actions")); addToolBar(tb); // QMenu *menu = new QMenu(tr("F&ormat"), this); // menuBar()->addMenu(menu); actionTextBold = new QAction(QIcon::fromTheme("format-text-bold", QIcon(rsrcPath + "/textbold.png")), tr("&Bold"), this); actionTextBold->setShortcut(Qt::CTRL + Qt::Key_B); actionTextBold->setPriority(QAction::LowPriority); QFont bold; bold.setBold(true); actionTextBold->setFont(bold); connect(actionTextBold, SIGNAL(triggered()), this, SLOT(textBold())); tb->addAction(actionTextBold); // menu->addAction(actionTextBold); actionTextBold->setCheckable(true); //inifontsize actionTextDump = new QAction(QIcon::fromTheme("format-text-bold", QIcon(rsrcPath + "/textbold.png")), tr("&Dump"), this); connect(actionTextDump, SIGNAL(triggered()), this, SLOT(dividePages())); tb->addAction(actionTextDump); // menu->addAction(actionTextDump); actionTextItalic = new QAction(QIcon::fromTheme("format-text-italic", QIcon(rsrcPath + "/textitalic.png")), tr("&Italic"), this); actionTextItalic->setPriority(QAction::LowPriority); actionTextItalic->setShortcut(Qt::CTRL + Qt::Key_I); QFont italic; italic.setItalic(true); actionTextItalic->setFont(italic); connect(actionTextItalic, SIGNAL(triggered()), this, SLOT(textItalic())); tb->addAction(actionTextItalic); // menu->addAction(actionTextItalic); actionTextItalic->setCheckable(true); actionTextUnderline = new QAction(QIcon::fromTheme("format-text-underline", QIcon(rsrcPath + "/textunder.png")), tr("&Underline"), this); actionTextUnderline->setShortcut(Qt::CTRL + Qt::Key_U); actionTextUnderline->setPriority(QAction::LowPriority); QFont underline; underline.setUnderline(true); actionTextUnderline->setFont(underline); connect(actionTextUnderline, SIGNAL(triggered()), this, SLOT(textUnderline())); tb->addAction(actionTextUnderline); // menu->addAction(actionTextUnderline); actionTextUnderline->setCheckable(true); // menu->addSeparator(); QActionGroup *grp = new QActionGroup(this); connect(grp, SIGNAL(triggered(QAction*)), this, SLOT(textAlign(QAction*))); // Make sure the alignLeft is always left of the alignRight if (QApplication::isLeftToRight()) { actionAlignLeft = new QAction(QIcon::fromTheme("format-justify-left", QIcon(rsrcPath + "/textleft.png")), tr("&Left"), grp); actionAlignCenter = new QAction(QIcon::fromTheme("format-justify-center", QIcon(rsrcPath + "/textcenter.png")), tr("C&enter"), grp); actionAlignRight = new QAction(QIcon::fromTheme("format-justify-right", QIcon(rsrcPath + "/textright.png")), tr("&Right"), grp); } else { actionAlignRight = new QAction(QIcon::fromTheme("format-justify-right", QIcon(rsrcPath + "/textright.png")), tr("&Right"), grp); actionAlignCenter = new QAction(QIcon::fromTheme("format-justify-center", QIcon(rsrcPath + "/textcenter.png")), tr("C&enter"), grp); actionAlignLeft = new QAction(QIcon::fromTheme("format-justify-left", QIcon(rsrcPath + "/textleft.png")), tr("&Left"), grp); } actionAlignJustify = new QAction(QIcon::fromTheme("format-justify-fill", QIcon(rsrcPath + "/textjustify.png")), tr("&Justify"), grp); actionAlignLeft->setShortcut(Qt::CTRL + Qt::Key_L); actionAlignLeft->setCheckable(true); actionAlignLeft->setPriority(QAction::LowPriority); actionAlignCenter->setShortcut(Qt::CTRL + Qt::Key_E); actionAlignCenter->setCheckable(true); actionAlignCenter->setPriority(QAction::LowPriority); actionAlignRight->setShortcut(Qt::CTRL + Qt::Key_R); actionAlignRight->setCheckable(true); actionAlignRight->setPriority(QAction::LowPriority); actionAlignJustify->setShortcut(Qt::CTRL + Qt::Key_J); actionAlignJustify->setCheckable(true); actionAlignJustify->setPriority(QAction::LowPriority); tb->addActions(grp->actions()); // menu->addActions(grp->actions()); // menu->addSeparator(); QPixmap pix(16, 16); pix.fill(Qt::black); actionTextColor = new QAction(pix, tr("&Color..."), this); connect(actionTextColor, SIGNAL(triggered()), this, SLOT(textColor())); tb->addAction(actionTextColor); // menu->addAction(actionTextColor); tb = new QToolBar(this); tb->setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea); tb->setWindowTitle(tr("Format Actions")); addToolBarBreak(Qt::TopToolBarArea); addToolBar(tb); comboStyle = new QComboBox(tb); tb->addWidget(comboStyle); comboStyle->addItem("Standard"); comboStyle->addItem("Bullet List (Disc)"); comboStyle->addItem("Bullet List (Circle)"); comboStyle->addItem("Bullet List (Square)"); comboStyle->addItem("Ordered List (Decimal)"); comboStyle->addItem("Ordered List (Alpha lower)"); comboStyle->addItem("Ordered List (Alpha upper)"); comboStyle->addItem("Ordered List (Roman lower)"); comboStyle->addItem("Ordered List (Roman upper)"); connect(comboStyle, SIGNAL(activated(int)), this, SLOT(textStyle(int))); // comboFont = new QFontComboBox(tb); // tb->addWidget(comboFont); // connect(comboFont, SIGNAL(activated(QString)), // this, SLOT(textFamily(QString))); // comboSize = new QComboBox(tb); // comboSize->setObjectName("comboSize"); // tb->addWidget(comboSize); // comboSize->setEditable(true); // QFontDatabase db; // foreach(int size, db.standardSizes()) // comboSize->addItem(QString::number(size)); // connect(comboSize, SIGNAL(activated(QString)), // this, SLOT(textSize(QString))); // comboSize->setCurrentIndex(comboSize->findText(QString::number(QApplication::font() // .pointSize()))); comboPn = new QComboBox(tb); comboPn->setObjectName("comboPn"); tb->addWidget(comboPn); comboPn->setEditable(true); QFontDatabase db; for(int size=1;size<=docs.size();size++) comboPn->addItem(QString::number(size)); connect(comboPn, SIGNAL(activated(QString)), this, SLOT(pageChanged(QString))); //comboPn->setCurrentIndex(1); }
MainWindow::MainWindow() { currentFrameIndex = 0; resize(500, 500); fileCutter = NULL; glWidget = new GLWidget(this); setCentralWidget(glWidget); glWidget->show(); //------------------------------------- mainToolbar = new QToolBar("main toolbar", this); mainToolbar->setIconSize(QSize(22, 22)); actionFileOpen = new QAction(QIcon(":/images/document-open.png"), "open", this); mainToolbar->addAction(actionFileOpen); connect(actionFileOpen, SIGNAL(triggered()), this, SLOT(slotFileOpen())); actionVisibleBrokenEdges = new QAction(QIcon(":/images/insert-link.png"), "show broken edges", this); actionVisibleBrokenEdges->setCheckable(true); mainToolbar->addAction(actionVisibleBrokenEdges); connect(actionVisibleBrokenEdges, SIGNAL(toggled(bool)), glWidget, SLOT(setVisibleBrokenEdges(bool))); addToolBar(Qt::TopToolBarArea, mainToolbar); //------------------------------------- playbackToolbar = new QToolBar("playback toolbar", this); actionPlaybackStart = new QAction(QIcon(":/images/media-playback-start.png"), "Play", this); playbackToolbar->addAction(actionPlaybackStart); connect(actionPlaybackStart, SIGNAL(triggered()), this, SLOT(slotPlaybackStart())); actionPlaybackPause = new QAction(QIcon(":/images/media-playback-pause.png"), "Pause", this); playbackToolbar->addAction(actionPlaybackPause); connect(actionPlaybackPause, SIGNAL(triggered()), this, SLOT(slotPlaybackPause())); playbackSlider = new PlaybackSlider(playbackToolbar); playbackSliderAction = playbackToolbar->addWidget(playbackSlider); addToolBar(Qt::BottomToolBarArea, playbackToolbar); timePlot = new TimePlot(); addDockWidget(Qt::BottomDockWidgetArea, timePlot); timePlot->setFeatures(0); connect(playbackSlider, SIGNAL(valueChanged(int)), this, SLOT(slotGotoFrame(int))); connect(playbackSlider, SIGNAL(valueChanged(int)), timePlot, SLOT(moveCurrentMark(int))); actionPlaybackStart->setVisible(false); actionPlaybackPause->setVisible(false); //------------------------------- connect(&playbackTimer, SIGNAL(timeout()), this, SLOT(slotPlaybackNextFrame())); //------------------------------- setStatusBar(new QStatusBar()); //------------------------------- commentDock = new CommentDock; addDockWidget(Qt::RightDockWidgetArea, commentDock); }
void NavFichiers::creerActions() { toolBar = addToolBar("Raccourcis"); toolBar->setObjectName("Raccourcis"); toolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); actionPrecedent = new QAction("Précédent", this); actionPrecedent->setIcon(QIcon(":/icones/nav_fichiers/actionPrecedent.png")); connect(actionPrecedent, SIGNAL(triggered()), this, SLOT(slotPrecedent())); toolBar->addAction(actionPrecedent); actionSuivant = new QAction("Suivant", this); actionSuivant->setIcon(QIcon(":/icones/nav_fichiers/actionSuivant.png")); connect(actionSuivant, SIGNAL(triggered()), this, SLOT(slotSuivant())); toolBar->addAction(actionSuivant); actionHaut = new QAction("Haut", this); actionHaut->setIcon(QIcon(":/icones/nav_fichiers/actionHaut.png")); connect(actionHaut, SIGNAL(triggered()), this, SLOT(slotHaut())); toolBar->addAction(actionHaut); actionActualiser = new QAction("Actualiser", this); actionActualiser->setIcon(QIcon(":/icones/nav_fichiers/actionActualiser.png")); connect(actionActualiser, SIGNAL(triggered()), this, SLOT(slotActualiser())); toolBar->addAction(actionActualiser); toolBar->addSeparator(); actionDossierPersonnel = new QAction("Dossier personnel", this); actionDossierPersonnel->setIcon(QIcon(":/icones/nav_fichiers/actionDossierPersonnel.png")); connect(actionDossierPersonnel, SIGNAL(triggered()), this, SLOT(slotDossierPersonnel())); toolBar->addAction(actionDossierPersonnel); actionDossierTelechargements = new QAction("Téléchargements", this); actionDossierTelechargements->setIcon(QIcon(":/icones/nav_fichiers/actionDossierTelechargements.png")); connect(actionDossierTelechargements, SIGNAL(triggered()), this, SLOT(slotDossierTelechargements())); toolBar->addAction(actionDossierTelechargements); actionDossiersCaches = new QAction("Éléments cachés", this); actionDossiersCaches->setIcon(QIcon(":/icones/nav_fichiers/actionDossiersCaches.png")); connect(actionDossiersCaches, SIGNAL(triggered()), this, SLOT(slotDossiersCaches())); toolBar->addAction(actionDossiersCaches); actionDossierRacine = new QAction("Racine", this); actionDossierRacine->setIcon(QIcon(":/icones/nav_fichiers/actionDossierRacine.png")); connect(actionDossierRacine, SIGNAL(triggered()), this, SLOT(slotDossierRacine())); toolBar->addAction(actionDossierRacine); actionDossierTmp = new QAction("Dossier temporaire", this); actionDossierTmp->setIcon(QIcon(":/icones/nav_fichiers/actionDossierTmp.png")); connect(actionDossierTmp, SIGNAL(triggered()), this, SLOT(slotDossierTmp())); toolBar->addAction(actionDossierTmp); addToolBarBreak(); toolBar2 = addToolBar("Adresse"); toolBar2->setObjectName("Adresse"); afficherCheminActuel = new LineEdit; connect(afficherCheminActuel, SIGNAL(returnPressed()), this, SLOT(slotGo())); toolBar2->addWidget(afficherCheminActuel); actionGo = new QAction("Go", this); actionGo->setIcon(QIcon(":/icones/nav_fichiers/actionGo.png")); connect(actionGo, SIGNAL(triggered()), this, SLOT(slotGo())); toolBar2->addAction(actionGo); actionNouvelOnglet = new QAction("Nouvel onglet", this); actionNouvelOnglet->setIcon(QIcon(":/icones/nav_fichiers/actionNouvelOnglet.png")); actionNouvelOnglet->setShortcut(QKeySequence("Ctrl+T")); connect(actionNouvelOnglet, SIGNAL(triggered()), this, SLOT(ajouterOnglet())); actionFermerOnglet = new QAction("Fermer l'onglet", this); actionFermerOnglet->setIcon(QIcon(":/icones/nav_fichiers/actionFermerOnglet.png")); actionFermerOnglet->setShortcut(QKeySequence("Ctrl+W")); actionFermerOnglet->setEnabled(false); connect(actionFermerOnglet, SIGNAL(triggered()), this, SLOT(slotFermerOnglet())); }
MainWindow::MainWindow() : QMainWindow(0) { readSettings(); QString lang = getSettingsGeneralLanguage(); qDebug("language: %s", qPrintable(lang)); if(lang == "system") lang = QLocale::system().languageToString(QLocale::system().language()).toLower(); //Load translations for the Embroidermodder 2 GUI QTranslator translatorEmb; translatorEmb.load("translations/" + lang + "/embroidermodder2_" + lang); qApp->installTranslator(&translatorEmb); //Load translations for the commands QTranslator translatorCmd; translatorCmd.load("translations/" + lang + "/commands_" + lang); qApp->installTranslator(&translatorCmd); //Load translations provided by Qt - this covers dialog buttons and other common things. QTranslator translatorQt; translatorQt.load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); qApp->installTranslator(&translatorQt); //Init mainWin = this; //Menus fileMenu = new QMenu(tr("&File"), this); editMenu = new QMenu(tr("&Edit"), this); viewMenu = new QMenu(tr("&View"), this); settingsMenu = new QMenu(tr("&Settings"), this); windowMenu = new QMenu(tr("&Window"), this); helpMenu = new QMenu(tr("&Help"), this); //SubMenus recentMenu = new QMenu(tr("Open &Recent"), this); zoomMenu = new QMenu(tr("&Zoom"), this); panMenu = new QMenu(tr("&Pan"), this); //Toolbars toolbarFile = addToolBar(tr("File")); toolbarEdit = addToolBar(tr("Edit")); toolbarView = addToolBar(tr("View")); toolbarZoom = addToolBar(tr("Zoom")); toolbarPan = addToolBar(tr("Pan")); toolbarIcon = addToolBar(tr("Icon")); toolbarHelp = addToolBar(tr("Help")); toolbarLayer = addToolBar(tr("Layer")); toolbarProperties = addToolBar(tr("Properties")); toolbarText = addToolBar(tr("Text")); toolbarPrompt = addToolBar(tr("Command Prompt")); //Selectors layerSelector = new QComboBox(this); colorSelector = new QComboBox(this); linetypeSelector = new QComboBox(this); lineweightSelector = new QComboBox(this); textFontSelector = new QFontComboBox(this); textSizeSelector = new QComboBox(this); numOfDocs = 0; docIndex = 0; shiftKeyPressedState = false; setWindowIcon(QIcon("icons/" + getSettingsGeneralIconTheme() + "/" + "app" + ".png")); //create the mdiArea QFrame* vbox = new QFrame(this); QVBoxLayout* layout = new QVBoxLayout(vbox); layout->setMargin(0); vbox->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); mdiArea = new MdiArea(this, vbox); mdiArea->useBackgroundLogo(getSettingsGeneralMdiBGUseLogo()); mdiArea->useBackgroundTexture(getSettingsGeneralMdiBGUseTexture()); mdiArea->useBackgroundColor(getSettingsGeneralMdiBGUseColor()); mdiArea->setBackgroundLogo(getSettingsGeneralMdiBGLogo()); mdiArea->setBackgroundTexture(getSettingsGeneralMdiBGTexture()); mdiArea->setBackgroundColor(QColor(getSettingsGeneralMdiBGColor())); mdiArea->setViewMode(QMdiArea::TabbedView); mdiArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); mdiArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); mdiArea->setActivationOrder(QMdiArea::ActivationHistoryOrder); layout->addWidget(mdiArea); setCentralWidget(vbox); //create the Command Prompt prompt = new CmdPrompt(this); prompt->setFocus(Qt::OtherFocusReason); this->setFocusProxy(prompt); mdiArea->setFocusProxy(prompt); prompt->setPromptTextColor(QColor(getSettingsPromptTextColor())); prompt->setPromptBackgroundColor(QColor(getSettingsPromptBGColor())); connect(prompt, SIGNAL(startCommand(const QString&)), this, SLOT(runCommandMain(const QString&))); connect(prompt, SIGNAL(runCommand(const QString&, const QString&)), this, SLOT(runCommandPrompt(const QString&, const QString&))); connect(prompt, SIGNAL(deletePressed()), this, SLOT(deletePressed())); //TODO: connect(prompt, SIGNAL(tabPressed()), this, SLOT(someUnknownSlot())); connect(prompt, SIGNAL(escapePressed()), this, SLOT(escapePressed())); connect(prompt, SIGNAL(F1Pressed()), this, SLOT(help())); //TODO: connect(prompt, SIGNAL(F2Pressed()), this, SLOT(floatHistory())); //TODO: connect(prompt, SIGNAL(F3Pressed()), this, SLOT(toggleQSNAP())); connect(prompt, SIGNAL(F4Pressed()), this, SLOT(toggleLwt())); //TODO: typically this is toggleTablet(), make F-Keys customizable thru settings //TODO: connect(prompt, SIGNAL(F5Pressed()), this, SLOT(toggleISO())); //TODO: connect(prompt, SIGNAL(F6Pressed()), this, SLOT(toggleCoords())); connect(prompt, SIGNAL(F7Pressed()), this, SLOT(toggleGrid())); //TODO: connect(prompt, SIGNAL(F8Pressed()), this, SLOT(toggleORTHO())); //TODO: connect(prompt, SIGNAL(F9Pressed()), this, SLOT(toggleSNAP())); //TODO: connect(prompt, SIGNAL(F10Pressed()), this, SLOT(togglePOLAR())); //TODO: connect(prompt, SIGNAL(F11Pressed()), this, SLOT(toggleQTRACK())); connect(prompt, SIGNAL(F12Pressed()), this, SLOT(toggleRuler())); connect(prompt, SIGNAL(cutPressed()), this, SLOT(cut())); connect(prompt, SIGNAL(copyPressed()), this, SLOT(copy())); connect(prompt, SIGNAL(pastePressed()), this, SLOT(paste())); connect(prompt, SIGNAL(selectAllPressed()), this, SLOT(selectAll())); connect(prompt, SIGNAL(undoPressed()), this, SLOT(undo())); connect(prompt, SIGNAL(redoPressed()), this, SLOT(redo())); connect(prompt, SIGNAL(shiftPressed()), this, SLOT(setShiftPressed())); connect(prompt, SIGNAL(shiftReleased()), this, SLOT(setShiftReleased())); //create the Object Property Editor dockPropEdit = new PropertyEditor("icons/" + getSettingsGeneralIconTheme(), getSettingsSelectionModePickAdd(), prompt, this); addDockWidget(Qt::LeftDockWidgetArea, dockPropEdit); connect(dockPropEdit, SIGNAL(pickAddModeToggled()), this, SLOT(pickAddModeToggled())); //create the Command History Undo Editor dockUndoEdit = new UndoEditor("icons/" + getSettingsGeneralIconTheme(), prompt, this); addDockWidget(Qt::LeftDockWidgetArea, dockUndoEdit); //setDockOptions(QMainWindow::AnimatedDocks | QMainWindow::AllowTabbedDocks | QMainWindow::VerticalTabs); //TODO: Load these from settings //tabifyDockWidget(dockPropEdit, dockUndoEdit); //TODO: load this from settings //Javascript initMainWinPointer(this); engine = new QScriptEngine(this); engine->installTranslatorFunctions(); debugger = new QScriptEngineDebugger(this); debugger->attachTo(engine); javaInitNatives(engine); //Load all commands in a loop QDir commandDir("commands"); QStringList cmdList = commandDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); foreach(QString cmdName, cmdList) { javaLoadCommand(cmdName); }
/* Settings Dialog Constructor: */ UISettingsDialog::UISettingsDialog(QWidget *pParent) /* Parent class: */ : QIWithRetranslateUI<QIMainDialog>(pParent) /* Protected variables: */ , m_pSelector(0) , m_pStack(0) /* Common variables: */ , m_dialogType(SettingsDialogType_Wrong) , m_fPolished(false) /* Loading/saving stuff: */ , m_fLoaded(false) , m_fSaved(false) /* Status bar stuff: */ , m_pStatusBar(new QStackedWidget(this)) /* Process bar stuff: */ , m_pProcessBar(new QProgressBar(this)) /* Error/Warning stuff: */ , m_fValid(true) , m_fSilent(true) , m_pWarningPane(new VBoxWarningPane(this)) /* Whats-this stuff: */ , m_pWhatsThisTimer(new QTimer(this)) , m_pWhatsThisCandidate(0) { /* Apply UI decorations: */ Ui::UISettingsDialog::setupUi(this); #ifdef Q_WS_MAC /* No status bar on the mac: */ setSizeGripEnabled(false); setStatusBar(0); #endif /* Q_WS_MAC */ /* Page-title font is derived from the system font: */ QFont pageTitleFont = font(); pageTitleFont.setBold(true); pageTitleFont.setPointSize(pageTitleFont.pointSize() + 2); m_pLbTitle->setFont(pageTitleFont); /* Get main grid layout: */ QGridLayout *pMainLayout = static_cast<QGridLayout*>(centralWidget()->layout()); #ifdef VBOX_GUI_WITH_TOOLBAR_SETTINGS /* No page-title with tool-bar: */ m_pLbTitle->hide(); /* No whats-this with tool-bar: */ m_pLbWhatsThis->hide(); /* Create modern tool-bar selector: */ m_pSelector = new VBoxSettingsToolBarSelector(this); static_cast<UIToolBar*>(m_pSelector->widget())->setMacToolbar(); addToolBar(qobject_cast<QToolBar*>(m_pSelector->widget())); /* No title in this mode, we change the title of the window: */ pMainLayout->setColumnMinimumWidth(0, 0); pMainLayout->setHorizontalSpacing(0); #else /* Create classical tree-view selector: */ m_pSelector = new VBoxSettingsTreeViewSelector(this); pMainLayout->addWidget(m_pSelector->widget(), 0, 0, 3, 1); m_pSelector->widget()->setFocus(); pMainLayout->setSpacing(10); #endif /* VBOX_GUI_WITH_TOOLBAR_SETTINGS */ /* Creating stack of pages: */ m_pStack = new QStackedWidget(m_pWtStackHandler); QVBoxLayout *pStackLayout = new QVBoxLayout(m_pWtStackHandler); pStackLayout->setContentsMargins(0, 0, 0, 0); pStackLayout->addWidget(m_pStack); /* Status bar: */ m_pStatusBar->addWidget(new QWidget); m_pButtonBox->addExtraWidget(m_pStatusBar); /* Setup process bar stuff: */ m_pStatusBar->addWidget(m_pProcessBar); /* Setup error & warning stuff: */ m_pStatusBar->addWidget(m_pWarningPane); m_errorIcon = UIIconPool::defaultIcon(UIIconPool::MessageBoxCriticalIcon, this).pixmap(16, 16); m_warningIcon = UIIconPool::defaultIcon(UIIconPool::MessageBoxWarningIcon, this).pixmap(16, 16); /* Setup whatsthis stuff: */ qApp->installEventFilter(this); m_pWhatsThisTimer->setSingleShot(true); connect(m_pWhatsThisTimer, SIGNAL(timeout()), this, SLOT(sltUpdateWhatsThis())); m_pLbWhatsThis->setAutoFillBackground(true); QPalette whatsThisPalette = m_pLbWhatsThis->palette(); whatsThisPalette.setBrush(QPalette::Window, whatsThisPalette.brush(QPalette::Midlight)); m_pLbWhatsThis->setPalette(whatsThisPalette); m_pLbWhatsThis->setFixedHeight(m_pLbWhatsThis->frameWidth() * 2 + m_pLbWhatsThis->margin() * 2 + m_pLbWhatsThis->fontMetrics().lineSpacing() * 4); /* Set the default button: */ m_pButtonBox->button(QDialogButtonBox::Ok)->setDefault(true); /* Setup connections: */ connect(m_pSelector, SIGNAL(categoryChanged(int)), this, SLOT(sltCategoryChanged(int))); connect(m_pButtonBox, SIGNAL(helpRequested()), &msgCenter(), SLOT(sltShowHelpHelpDialog())); /* Translate UI: */ retranslateUi(); }
PQTextEditor::PQTextEditor(QWidget* parent): QMainWindow(parent) { QWidget *centralWidget = new QWidget(this); mLayout = new QGridLayout(centralWidget); centralWidget->setLayout(mLayout); setCentralWidget(centralWidget); mEditor = new QTextEdit(this); mLayout->addWidget(mEditor, 0, 0); connect(mEditor, SIGNAL(textChanged()), SIGNAL(textChanged())); QAction *action; QToolBar *toolbar = addToolBar(tr("Edit Toolbar")); addAction(toolbar, QLatin1String("undo"), QLatin1String("edit-undo"), tr("Undo"), false, QKeySequence::Undo, mEditor, SLOT(undo())); addAction(toolbar, QLatin1String("redo"), QLatin1String("edit-redo"), tr("Redo"), false, QKeySequence::Redo, mEditor, SLOT(redo())); addAction(toolbar, QLatin1String("cut"), QLatin1String("edit-cut"), tr("Cut"), false,QKeySequence::Cut, mEditor, SLOT(cut())); addAction(toolbar, QLatin1String("copy"), QLatin1String("edit-copy"), tr("Copy"), false,QKeySequence::Copy, mEditor, SLOT(copy())); addAction(toolbar, QLatin1String("paste"), QLatin1String("edit-paste"), tr("Paste"), false,QKeySequence::Paste, mEditor, SLOT(paste())); toolbar = addToolBar(tr("Format Toolbar")); addAction(toolbar, QLatin1String("bold"), QLatin1String("format-text-bold"), tr("Bold"), true, QKeySequence::Bold, this, SLOT(slotToggleBold())); addAction(toolbar, QLatin1String("italic"), QLatin1String("format-text-italic"), tr("Italic"), true, QKeySequence::Italic, this, SLOT(slotToggleItalic())); addAction(toolbar, QLatin1String("strikethrough"), QLatin1String("format-text-strikethrough"), tr("Strikethrough"), true, QKeySequence(), this, SLOT(slotToggleStrikethrough())); addAction(toolbar, QLatin1String("underline"), QLatin1String("format-text-underline"), tr("Underline"), true, QKeySequence::Underline, this, SLOT(slotToggleUnderline())); toolbar->addSeparator(); QActionGroup *group = new QActionGroup(this); group->addAction(addAction(toolbar, QLatin1String("justify-left"), QLatin1String("format-justify-left"), tr("Justify Left"), true, QKeySequence(), this, SLOT(slotJustifyLeft()))); group->addAction(addAction(toolbar, QLatin1String("justify-center"), QLatin1String("format-justify-center"), tr("Justify Center"), true, QKeySequence(), this, SLOT(slotJustifyCenter()))); group->addAction(addAction(toolbar, QLatin1String("justify-fill"), QLatin1String("format-justify-fill"), tr("Justify Fill"), true, QKeySequence(), this, SLOT(slotJustifyFill()))); group->addAction(addAction(toolbar, QLatin1String("justify-right"), QLatin1String("format-justify-right"), tr("Justify Right"), true, QKeySequence(), this, SLOT(slotJustifyRight()))); toolbar->addSeparator(); addAction(toolbar, QLatin1String("unindent"), QLatin1String("format-indent-less"), tr("Unindent"), false, QKeySequence(), this, SLOT(slotUnindent())); addAction(toolbar, QLatin1String("indent"), QLatin1String("format-indent-more"), tr("Indent"), false, QKeySequence(), this, SLOT(slotIndent())); mStyleComboBox = new QComboBox(this); mStyleComboBox->addItem(tr("Standard")); mStyleComboBox->addItem(tr("Bullet List (Disc)")); mStyleComboBox->addItem(tr("Bullet List (Circle)")); mStyleComboBox->addItem(tr("Bullet List (Square)")); mStyleComboBox->addItem(tr("Ordered List (Decimal)")); mStyleComboBox->addItem(tr("Ordered List (Alpha lower)")); mStyleComboBox->addItem(tr("Ordered List (Alpha upper)")); mStyleComboBox->addItem(tr("Ordered List (Roman lower)")); mStyleComboBox->addItem(tr("Ordered List (Roman upper)")); connect(mStyleComboBox, SIGNAL(currentIndexChanged(int)), SLOT(slotChangeStyle(int))); mFontComboBox = new QFontComboBox(this); connect(mFontComboBox, SIGNAL(currentFontChanged(QFont)), SLOT(slotChangeFont(QFont))); mFontSizeComboBox = new QComboBox(this); QFontDatabase db; Q_FOREACH (int size, db.standardSizes()) { mFontSizeComboBox->addItem(QString::number(size)); } /* Initialize */ mFontSizeComboBox->setCurrentIndex(mFontSizeComboBox->findText(QString::number(QApplication::font().pointSize()))); connect(mFontSizeComboBox, SIGNAL(currentIndexChanged(int)), SLOT(slotChangeFontSize(int))); QPixmap pixmap(16, 16); pixmap.fill(mEditor->textColor()); QAction *colorAction = new QAction(pixmap, tr("Color"), this); connect(colorAction, SIGNAL(triggered(bool)), SLOT(slotChangeColor())); addToolBarBreak(); toolbar = addToolBar(tr("Font Toolbar")); toolbar->addWidget(mStyleComboBox); toolbar->addWidget(mFontComboBox); toolbar->addWidget(mFontSizeComboBox); toolbar->addAction(colorAction); }
void ImageViewer::createActions() { openAct = new QAction(tr("&Open..."), this); // openAct->setShortcut(tr("Ctrl+O")); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); printAct = new QAction(tr("&Print..."), this); // printAct->setShortcut(tr("Ctrl+P")); printAct->setEnabled(false); connect(printAct, SIGNAL(triggered()), this, SLOT(print())); exitAct = new QAction(tr("E&xit"), this); // exitAct->setShortcut(tr("Ctrl+Q")); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); zoomInAct = new QAction(tr("Zoom &In (10%)"), this); // zoomInAct->setShortcut(tr("Ctrl++")); zoomInAct->setEnabled(false); connect(zoomInAct, SIGNAL(triggered()), this, SLOT(zoomIn())); zoomOutAct = new QAction(tr("Zoom &Out (10%)"), this); // zoomOutAct->setShortcut(tr("Ctrl+-")); zoomOutAct->setEnabled(false); connect(zoomOutAct, SIGNAL(triggered()), this, SLOT(zoomOut())); normalSizeAct = new QAction(tr("&Normal Size"), this); // normalSizeAct->setShortcut(tr("Ctrl+S")); normalSizeAct->setEnabled(false); connect(normalSizeAct, SIGNAL(triggered()), this, SLOT(normalSize())); fitToWindowAct = new QAction(tr("&Fit to Window"), this); fitToWindowAct->setEnabled(false); fitToWindowAct->setCheckable(true); // fitToWindowAct->setShortcut(tr("Ctrl+F")); connect(fitToWindowAct, SIGNAL(triggered()), this, SLOT(fitToWindow())); aboutAct = new QAction(tr("&About"), this); connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); aboutQtAct = new QAction(tr("About &Qt"), this); connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt())); crop = new QAction(tr("Crop"),this); crop->setEnabled(false); connect(crop,SIGNAL(triggered()),this,SLOT(saveSlot())); rotate_left_90 = new QAction(tr("Rotate left"),this); rotate_left_90->setEnabled(false); rotate_right_90 = new QAction(tr("rotate Right"),this); rotate_right_90->setEnabled(false); QSignalMapper *sm = new QSignalMapper(this); connect(rotate_left_90,SIGNAL(triggered()),sm,SLOT(map())); connect(rotate_right_90,SIGNAL(triggered()),sm,SLOT(map())); sm->setMapping(rotate_left_90,90); sm->setMapping(rotate_right_90,-90); connect (sm, SIGNAL(mapped(int)), this, SLOT(rotate_with_angle(int))) ; rotate_custom = new QAction(tr("Custom rotation"),this); rotate_custom->setEnabled(false); connect(rotate_custom,SIGNAL(triggered()),this,SLOT(rotate_custom_slot())); undo = new QAction(tr("Undo"),this); connect(undo,SIGNAL(triggered()),this,SLOT(undo_slot())); redo = new QAction(tr("Redo"),this); connect(redo,SIGNAL(triggered()),this,SLOT(redo_slot())); reset = new QAction(tr("Reset"),this); connect(reset,SIGNAL(triggered()),this,SLOT(reset_slot())); reset->setEnabled(false); QToolBar *tb = new QToolBar ; saveAs = new QAction(tr("Save As"),this); connect(saveAs,SIGNAL(triggered()),this,SLOT(saveAs_slot())); tb->addAction(openAct); tb->addAction(zoomInAct); tb->addAction(zoomOutAct); tb->addAction(crop); tb->addAction(rotate_left_90); tb->addAction(rotate_right_90); tb->addAction(undo); tb->addAction(redo); tb->addAction(reset); addToolBar(tb); }
void MainWindow::createToolBar() { fileToolBar = addToolBar( tr( " &File" ) ) ; fileToolBar->addAction(exportAction) ; fileToolBar->addAction(openFile); }
ezQtKrautTreeAssetDocumentWindow::ezQtKrautTreeAssetDocumentWindow(ezAssetDocument* pDocument) : ezQtEngineDocumentWindow(pDocument) { // Menu Bar { ezQtMenuBarActionMapView* pMenuBar = static_cast<ezQtMenuBarActionMapView*>(menuBar()); ezActionContext context; context.m_sMapping = "KrautTreeAssetMenuBar"; context.m_pDocument = pDocument; context.m_pWindow = this; pMenuBar->SetActionContext(context); } // Tool Bar { ezQtToolBarActionMapView* pToolBar = new ezQtToolBarActionMapView("Toolbar", this); ezActionContext context; context.m_sMapping = "KrautTreeAssetToolBar"; context.m_pDocument = pDocument; context.m_pWindow = this; pToolBar->SetActionContext(context); pToolBar->setObjectName("KrautTreeAssetWindowToolBar"); addToolBar(pToolBar); } // 3D View ezQtViewWidgetContainer* pContainer = nullptr; { SetTargetFramerate(25); m_ViewConfig.m_Camera.LookAt(ezVec3(-1.6, 0, 0), ezVec3(0, 0, 0), ezVec3(0, 0, 1)); m_ViewConfig.ApplyPerspectiveSetting(90); m_pViewWidget = new ezQtOrbitCamViewWidget(this, &m_ViewConfig); m_pViewWidget->ConfigureOrbitCameraVolume(ezVec3(0, 0, 1), ezVec3(10.0f), ezVec3(-5, 1, 2)); AddViewWidget(m_pViewWidget); pContainer = new ezQtViewWidgetContainer(this, m_pViewWidget, "MeshAssetViewToolBar"); setCentralWidget(pContainer); } // Property Grid { ezQtDocumentPanel* pPropertyPanel = new ezQtDocumentPanel(this); pPropertyPanel->setObjectName("KrautTreeAssetDockWidget"); pPropertyPanel->setWindowTitle("Kraut Tree Properties"); pPropertyPanel->show(); ezQtPropertyGridWidget* pPropertyGrid = new ezQtPropertyGridWidget(pPropertyPanel, pDocument); pPropertyPanel->setWidget(pPropertyGrid); addDockWidget(Qt::DockWidgetArea::RightDockWidgetArea, pPropertyPanel); pDocument->GetSelectionManager()->SetSelection(pDocument->GetObjectManager()->GetRootObject()->GetChildren()[0]); } m_pAssetDoc = static_cast<ezKrautTreeAssetDocument*>(pDocument); FinishWindowCreation(); QueryObjectBBox(0); }
void MainWindow::makeUI() { setObjectName(QString::fromUtf8("MainWindow")); #if 1 action_Exit = new QAction(this); action_Exit->setObjectName(QString::fromUtf8("action_Exit")); //connect(action_Exit, SIGNAL(triggered()), qApp, SLOT(quit())); connect(action_Exit, SIGNAL(triggered()), this, SLOT(close())); #endif centralwidget = new QWidget(this); centralwidget->setObjectName(QString::fromUtf8("centralwidget")); widget = new QWidget(centralwidget); widget->setObjectName(QString::fromUtf8("widget")); widget->setGeometry(QRect(190, 0, 1080, 821)); widget->setMinimumSize(QSize(400, 0)); vboxLayout = new QVBoxLayout(widget); vboxLayout->setSpacing(0); vboxLayout->setMargin(0); vboxLayout->setObjectName(QString::fromUtf8("vboxLayout")); dockWidget = new QDockWidget(widget); dockWidget->setObjectName(QString::fromUtf8("dockWidget")); QSizePolicy sizePolicy(static_cast<QSizePolicy::Policy>(7), static_cast<QSizePolicy::Policy>(7)); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(dockWidget->sizePolicy().hasHeightForWidth()); dockWidget->setSizePolicy(sizePolicy); dockWidgetContents = new QWidget(dockWidget); dockWidgetContents->setObjectName(QString::fromUtf8("dockWidgetContents")); vdockLayout = new QVBoxLayout(widget); vdockLayout->setSpacing(0); vdockLayout->setMargin(0); vdockLayout->setObjectName(QString::fromUtf8("vdockLayout")); stackedWidget = new QStackedWidget(dockWidgetContents); stackedWidget->setObjectName(QString::fromUtf8("stackedWidget")); stackedWidget->setGeometry(QRect(0, 0, 1080, 821)); dockWidget->setWidget(dockWidgetContents); vboxLayout->addWidget(dockWidget); dockWidgetContents->setLayout(vdockLayout); vdockLayout->addWidget(stackedWidget); tabWidget = new QTabWidget(centralwidget); tabWidget->setObjectName(QString::fromUtf8("tabWidget")); tabWidget->setGeometry(QRect(0, 0, 190, 821)); QSizePolicy sizePolicy1(static_cast<QSizePolicy::Policy>(5), static_cast<QSizePolicy::Policy>(5)); sizePolicy1.setHorizontalStretch(0); sizePolicy1.setVerticalStretch(0); sizePolicy1.setHeightForWidth(tabWidget->sizePolicy().hasHeightForWidth()); tabWidget->setSizePolicy(sizePolicy1); tabWidget->setMaximumSize(QSize(16777215, 16777215)); tabWidget->setTabPosition(QTabWidget::West); tabWidget->setTabShape(QTabWidget::Triangular); tabWidget->setElideMode(Qt::ElideNone); tab_0 = new QWidget(); tab_0->setObjectName(QString::fromUtf8("tab_0")); QFont font; font.setPointSize(14); vboxLayout0 = new QVBoxLayout(tab_0); vboxLayout0->setSpacing(6); vboxLayout0->setMargin(9); vboxLayout0->setAlignment(Qt::AlignTop); vboxLayout0->setObjectName(QString::fromUtf8("vboxLayout0")); pushButton[0] = new QPushButton(tab_0); pushButton[0]->setObjectName(QString::fromUtf8("pushButton_0")); pushButton[0]->setFont(font); pushButton[0]->setText(QApplication::translate("MainWindow", "PMS In Board", 0, QApplication::UnicodeUTF8)); vboxLayout0->addWidget(pushButton[0]); pushButton[1] = new QPushButton(tab_0); pushButton[1]->setObjectName(QString::fromUtf8("pushButton_1")); pushButton[1]->setFont(font); pushButton[1]->setText(QApplication::translate("MainWindow", "PMS Out Board", 0, QApplication::UnicodeUTF8)); vboxLayout0->addWidget(pushButton[1]); QSpacerItem *spacerItem; //spacerItem = new QSpacerItem(31, 61, QSizePolicy::Minimum, QSizePolicy::Expanding); spacerItem = new QSpacerItem(31, 61, QSizePolicy::Minimum, QSizePolicy::Fixed); vboxLayout0->addItem(spacerItem); //Add Code. archiveList = new QComboBox(tab_0); archiveList->setObjectName(QString::fromUtf8("archiveList")); vboxLayout0->addWidget(archiveList); Start_dateTime = new QDateTimeEdit(tab_0); Start_dateTime->setObjectName(QString::fromUtf8("Start_dateTime")); Start_dateTime->setDisplayFormat("yyyy/MM/dd hh:mm:ss"); Start_dateTime->setDateTime(QDateTime(QDate(2012,5,29), QTime(12,0,0))); vboxLayout0->addWidget(Start_dateTime); End_dateTime = new QDateTimeEdit(tab_0); End_dateTime->setObjectName(QString::fromUtf8("End_dateTime")); End_dateTime->setDisplayFormat("yyyy/MM/dd hh:mm:ss"); End_dateTime->setDateTime(QDateTime(QDate(2012,5,29), QTime(13,0,0))); vboxLayout0->addWidget(End_dateTime); RButton = new QPushButton(tab_0); RButton->setObjectName(QString::fromUtf8("RButton")); RButton->setText("OK"); if(RButton!=0) connect(RButton, SIGNAL(clicked()), this, SLOT(getChannelValues())); //RButton->setGeometry(QRect(980, 20, 80, 27)); vboxLayout0->addWidget(RButton); currentTimeLabel = new QLabel(tab_0); currentTimeLabel->setObjectName(QString::fromUtf8("currentTimeLabel")); currentTimeLabel->setText("Current Index Time"); //currentTimeLabel->setGeometry(QRect(760, 7, 161, 21)); vboxLayout0->addWidget(currentTimeLabel); timeSlider = new QSlider(tab_0); timeSlider->setObjectName(QString::fromUtf8("timeSlider")); //timeSlider->setGeometry(QRect(760, 24, 201, 16)); timeSlider->setValue(-1); timeSlider->setOrientation(Qt::Horizontal); connect(timeSlider, SIGNAL(valueChanged(int)), this, SLOT(readValue(int))); vboxLayout0->addWidget(timeSlider); //--> Splitter splitter = new QSplitter(tab_0); splitter->setObjectName(QString::fromUtf8("splitter")); splitter->setOrientation(Qt::Horizontal); incButtonDouble = new QPushButton(splitter); incButtonDouble->setObjectName(QString::fromUtf8("incButtonDouble")); QSizePolicy sizePol(QSizePolicy::Fixed, QSizePolicy::Fixed); sizePol.setHeightForWidth(incButtonDouble->sizePolicy().hasHeightForWidth()); incButtonDouble->setSizePolicy(sizePol); incButtonDouble->setText("<<"); connect(incButtonDouble,SIGNAL(clicked()), this, SLOT(decDouble())); splitter->addWidget(incButtonDouble); incButton = new QPushButton(splitter); incButton->setObjectName(QString::fromUtf8("incButton")); sizePol.setHeightForWidth(incButton->sizePolicy().hasHeightForWidth()); incButton->setSizePolicy(sizePol); incButton->setText("<"); connect(incButton,SIGNAL(clicked()), this, SLOT(decrease())); splitter->addWidget(incButton); decButton = new QPushButton(splitter); decButton->setObjectName(QString::fromUtf8("decButton")); sizePol.setHeightForWidth(decButton->sizePolicy().hasHeightForWidth()); decButton->setSizePolicy(sizePol); decButton->setText(">"); connect(decButton,SIGNAL(clicked()), this, SLOT(increase())); splitter->addWidget(decButton); decButtonDouble = new QPushButton(splitter); decButtonDouble->setObjectName(QString::fromUtf8("decButtonDouble")); sizePol.setHeightForWidth(decButtonDouble->sizePolicy().hasHeightForWidth()); decButtonDouble->setSizePolicy(sizePol); decButtonDouble->setText(">>"); connect(decButtonDouble,SIGNAL(clicked()), this, SLOT(incDouble())); splitter->addWidget(decButtonDouble); vboxLayout0->addWidget(splitter); //<-- Splitter splitter2 = new QSplitter(tab_0); splitter2->setObjectName(QString::fromUtf8("splitter2")); splitter2->setOrientation(Qt::Horizontal); stopButton = new QPushButton(splitter2); stopButton->setObjectName(QString::fromUtf8("stopButton")); sizePol.setHeightForWidth(stopButton->sizePolicy().hasHeightForWidth()); stopButton->setSizePolicy(sizePol); stopButton->setText("Stop"); connect(stopButton,SIGNAL(clicked()), this, SLOT(timerStop())); splitter2->addWidget(stopButton); startButton = new QPushButton(splitter2); startButton->setObjectName(QString::fromUtf8("startButton")); sizePol.setHeightForWidth(startButton->sizePolicy().hasHeightForWidth()); startButton->setSizePolicy(sizePol); startButton->setText("Run"); connect(startButton,SIGNAL(clicked()), this, SLOT(timerRun())); splitter2->addWidget(startButton); vboxLayout0->addWidget(splitter2); tabWidget->addTab(tab_0, QApplication::translate("MainWindow", "PMS Panel", 0, QApplication::UnicodeUTF8)); menubar = new QMenuBar(this); menubar->setObjectName(QString::fromUtf8("menubar")); menubar->setGeometry(QRect(0, 0, 1280, 30)); menu_File = new QMenu(menubar); menu_File->setObjectName(QString::fromUtf8("menu_File")); menu_Util = new QMenu(menubar); menu_Util->setObjectName(QString::fromUtf8("menu_Util")); menu_Help = new QMenu(menubar); menu_Help->setObjectName(QString::fromUtf8("menu_Help")); setMenuBar(menubar); QLabel *slabel1 = new QLabel("Set your mouse on the dynamic value to read PVNAME."); slabel1->setAlignment(Qt::AlignHCenter); slabel1->setMinimumSize(slabel1->sizeHint()); slabel1->setFrameStyle(QFrame::Panel | QFrame::Plain); QFrame *sframe = new QFrame(); QVBoxLayout *svlayout = new QVBoxLayout(sframe); svlayout->setSpacing(1); svlayout->setMargin(2); statusBar()->addWidget(sframe,1); toolBar = new QToolBar(this); toolBar->setObjectName(QString::fromUtf8("toolBar")); QPalette palette; QBrush brush(QColor(108, 147, 255, 100)); brush.setStyle(Qt::SolidPattern); palette.setBrush(QPalette::Active, QPalette::Base, brush); palette.setBrush(QPalette::Active, QPalette::AlternateBase, brush); QBrush brush1(QColor(44, 51, 91, 100)); brush1.setStyle(Qt::SolidPattern); palette.setBrush(QPalette::Active, QPalette::Window, brush1); QBrush brush2(QColor(108, 147, 255, 100)); brush2.setStyle(Qt::SolidPattern); palette.setBrush(QPalette::Inactive, QPalette::Base, brush2); QBrush brush3(QColor(44, 51, 91, 100)); brush3.setStyle(Qt::SolidPattern); palette.setBrush(QPalette::Inactive, QPalette::Window, brush3); QBrush brush4(QColor(44, 51, 91, 100)); brush4.setStyle(Qt::SolidPattern); palette.setBrush(QPalette::Disabled, QPalette::Base, brush4); QBrush brush5(QColor(44, 51, 91, 100)); brush5.setStyle(Qt::SolidPattern); palette.setBrush(QPalette::Disabled, QPalette::Window, brush5); toolBar->setPalette(palette); toolBar->setOrientation(Qt::Horizontal); addToolBar(static_cast<Qt::ToolBarArea>(4), toolBar); menubar->addAction(menu_File->menuAction()); menubar->addAction(menu_Util->menuAction()); menubar->addSeparator(); menubar->addAction(menu_Help->menuAction()); menu_File->addAction(action_Exit); QSize size(1280, 1024); size = size.expandedTo(minimumSizeHint()); resize(size); tabWidget->setCurrentIndex(0); QMetaObject::connectSlotsByName(this); msgframe = new QFrame(centralwidget); msgframe->setObjectName(QString::fromUtf8("msgframe")); QSizePolicy sizePolicy4(static_cast<QSizePolicy::Policy>(5), static_cast<QSizePolicy::Policy>(5)); sizePolicy4.setHorizontalStretch(0); sizePolicy4.setVerticalStretch(0); msgframe->setGeometry(QRect(19, 820, 1255, 90)); //msgframe->setSizePolicy(sizePolicy4); //msgframe->setGeometry(QRect(18, 880, 1254, 70)); //msgframe->setMinimumSize(QSize(1164, 90)); //msgframe->setFrameShape(QFrame::StyledPanel); //msgframe->setFrameShadow(QFrame::Raised); setCentralWidget(centralwidget); QObject::connect(tabWidget, SIGNAL(currentChanged(int)), SLOT(setDefaultIndex(int))); // Set Object Text. setWindowTitle(QApplication::translate("MainWindow", "PMS (Plant Monitoring System)", 0, QApplication::UnicodeUTF8)); action_Exit->setText(QApplication::translate("MainWindow", "e&Xit", 0, QApplication::UnicodeUTF8)); tabWidget->setTabText(tabWidget->indexOf(tab_0), QApplication::translate("MainWindow", "PMS Data Retrieval", 0, QApplication::UnicodeUTF8)); menu_File->setTitle(QApplication::translate("MainWindow", "&File", 0, QApplication::UnicodeUTF8)); menu_Util->setTitle(QApplication::translate("MainWindow", "&Util", 0, QApplication::UnicodeUTF8)); menu_Help->setTitle(QApplication::translate("MainWindow", "&Help", 0, QApplication::UnicodeUTF8)); } // makeUI
void MainWindow::makeMenu() { QToolBar *toolBar = new QToolBar( this ); QToolBar *searchBar = new QToolBar(this); QMenuBar *menuBar = new QMenuBar( toolBar ); QPopupMenu *searchMenu = new QPopupMenu( menuBar ); // QPopupMenu *viewMenu = new QPopupMenu( menuBar ); QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); QPopupMenu *searchOptions = new QPopupMenu( cfgMenu ); setToolBarsMovable( false ); toolBar->setHorizontalStretchable( true ); menuBar->insertItem( tr( "Search" ), searchMenu ); menuBar->insertItem( tr( "Settings" ), cfgMenu ); //SETTINGS MENU cfgMenu->insertItem( tr( "Search" ), searchOptions ); QPopupMenu *pop; for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ pop = s->popupMenu(); if (pop){ cfgMenu->insertItem( s->text(0), pop ); } } //SEARCH SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 ); SearchAllAction->setIconSet( Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ) ); // QWhatsThis::add( SearchAllAction, tr("Search everything...") ); connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) ); SearchAllAction->addTo( searchMenu ); searchMenu->insertItem( tr( "Options" ), searchOptions ); //SEARCH OPTIONS //actionWholeWordsOnly = new QAction( tr("Whole words only"),QString::null, 0, this, 0, true ); //actionWholeWordsOnly->addTo( searchOptions ); actionCaseSensitiv = new QAction( tr("Case sensitive"),QString::null, 0, this, 0, true ); actionCaseSensitiv->addTo( searchOptions ); actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true ); actionWildcards->addTo( searchOptions ); //SEARCH BAR LabelEnterText = new QLabel( searchBar, "Label" ); LabelEnterText->setAutoMask( FALSE ); LabelEnterText->setText( tr( "Search for: " ) ); LabelEnterText->setFrameStyle( QFrame::NoFrame ); LabelEnterText->setBackgroundMode( PaletteButton ); addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" ); QWhatsThis::add( searchEdit, tr("Enter your search terms here") ); searchEdit->setFocus(); searchBar->setHorizontalStretchable( TRUE ); searchBar->setStretchableWidget( searchEdit ); //Search button SearchAllAction->addTo( searchBar ); //Clear text ClearSearchText = new QToolButton( searchBar, "ClearSearchText"); ClearSearchText->setText( "" ); ClearSearchText->setPixmap( Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ) ); connect( searchEdit, SIGNAL( textChanged(const QString&) ),this, SLOT( setSearch(const QString&) ) ); connect( ClearSearchText, SIGNAL( clicked() ), searchEdit, SLOT( clear() ) ); }
RMainWnd::RMainWnd(reditor::REditor* edit) : QMainWindow(), medit(edit) { setWindowTitle(tr("Room Editor")); setWindowIcon(QIcon(":/resources/favicon.ico")); // central widget meditWnd = new REditWnd(medit->objects(), medit->camera(), this); setCentralWidget(meditWnd); // set corners for docks setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea); setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea); setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea); setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea); // docks mloggerDock = new QDockWidget(this); mloggerDock->setWindowTitle(tr("Editor Log")); mlogger = new RLogger(mloggerDock); mloggerDock->setWidget(mlogger); addDockWidget(Qt::BottomDockWidgetArea, mloggerDock); // TODO attach dock window with objects on the scene // File menu QMenu* fileMenu = menuBar()->addMenu(tr("&File")); QAction* newAction = fileMenu->addAction(tr("&New Project"), this, SIGNAL(newProject()), QKeySequence::New); newAction->setIcon(QIcon(":/resources/new.png")); QAction* openAction = fileMenu->addAction(tr("&Open Project.."), this, SIGNAL(openProject()), QKeySequence::Open); openAction->setIcon(QIcon(":/resources/open.png")); fileMenu->addSeparator(); msaveAction = fileMenu->addAction(tr("&Save Project"), this, SIGNAL(saveProject()), QKeySequence::Save); msaveAction->setIcon(QIcon(":/resources/save.png")); msaveAsAction = fileMenu->addAction(tr("S&ave Project As..."), this, SIGNAL(saveProjectAs()), Qt::SHIFT + Qt::CTRL + Qt::Key_S); msaveAsAction->setIcon(QIcon(":/resources/saveAs.png")); enableSave(false); // activate after user makes some changes, no sense to save empty project fileMenu->addSeparator(); fileMenu->addAction(tr("&Exit.."), this, SLOT(close()), QKeySequence::Quit); // Help menu QMenu* helpMenu = menuBar()->addMenu(tr("&Help")); helpMenu->addAction(tr("&About RoomEdit"), this, SIGNAL(helpAbout())); // File toolbar QToolBar* fileToolBar = addToolBar(tr("File")); fileToolBar->addAction(newAction); fileToolBar->addAction(openAction); fileToolBar->addSeparator(); fileToolBar->addAction(msaveAction); fileToolBar->addAction(msaveAsAction); // Camera view toolbar QToolBar* cameraToolBar = addToolBar(tr("Camera")); mcameraGroup = new QButtonGroup(cameraToolBar); QPushButton * cam1 = new QPushButton(QString("1"), this); QPushButton * cam2 = new QPushButton(QString("2"), this); QPushButton * cam3 = new QPushButton(QString("3"), this); cam1->setCheckable(true); cam2->setCheckable(true); cam3->setCheckable(true); cam1->setChecked(true); mcameraGroup->addButton(cam1, 1); mcameraGroup->addButton(cam2, 2); mcameraGroup->addButton(cam3, 3); mcameraGroup->setExclusive(true); connect(mcameraGroup, SIGNAL(buttonClicked(int)), this, SIGNAL(switchCamera(int))); cameraToolBar->addWidget(cam1); cameraToolBar->addWidget(cam2); cameraToolBar->addWidget(cam3); }
// id is an old ident in case of an import ActivityDiagramWindow::ActivityDiagramWindow(const QString & s, BrowserActivityDiagram * b, int id) : DiagramWindow(b, s), view(0) { QToolBar * toolbar = new QToolBar(this, "activity operations"); addToolBar(toolbar, TR("Toolbar"), Top, TRUE); add_edit_button(toolbar); select = new QToolButton(*selectButton, TR("Select"), QString::null, this, SLOT(hit_select()), toolbar, "select"); select->setToggleButton(TRUE); select->setOn(TRUE); current_button = UmlSelect; addPackage = new QToolButton(*packageButton, TR("New Package"), QString::null, this, SLOT(hit_package()), toolbar, "add package"); addPackage->setToggleButton(TRUE); QWhatsThis::add(addPackage, addpackageText()); addFragment = new QToolButton(*fragmentButton, TR("New Fragment"), QString::null, this, SLOT(hit_fragment()), toolbar, "add fragment"); addFragment->setToggleButton(TRUE); QWhatsThis::add(addFragment, addfragmentText()); addActivity = new QToolButton(*activityButton, TR("New Activity"), QString::null, this, SLOT(hit_activity()), toolbar, "add activity"); addActivity->setToggleButton(TRUE); QWhatsThis::add(addActivity, addactivityText()); addInterruptibleActivityRegion = new QToolButton(*interruptibleactivityregionButton, TR("New Interruptible Activity Region"), QString::null, this, SLOT(hit_interruptibleactivityregion()), toolbar, "add interruptible activity region"); addInterruptibleActivityRegion->setToggleButton(TRUE); QWhatsThis::add(addInterruptibleActivityRegion, addinterruptibleactivityregionText()); addExpansionRegion = new QToolButton(*expansionregionButton, TR("New Expansion Region"), QString::null, this, SLOT(hit_expansionregion()), toolbar, "add expansion region"); addExpansionRegion->setToggleButton(TRUE); QWhatsThis::add(addExpansionRegion, addexpansionregionText()); addActivityPartition = new QToolButton(*activitypartitionButton, TR("New Activity Partition"), QString::null, this, SLOT(hit_activitypartition()), toolbar, "add activity partition"); addActivityPartition->setToggleButton(TRUE); QWhatsThis::add(addActivityPartition, addactivitypartitionText()); addAction = new QToolButton(*activityactionButton, TR("New Action"), QString::null, this, SLOT(hit_action()), toolbar, "add action"); addAction->setToggleButton(TRUE); QWhatsThis::add(addAction, addactionText()); addObject = new QToolButton(*actionButton, TR("New Object Node"), QString::null, this, SLOT(hit_object()), toolbar, "add object node"); addObject->setToggleButton(TRUE); QWhatsThis::add(addObject, addobjectText()); addInitial = new QToolButton(*initialButton, TR("New Initial node"), QString::null, this, SLOT(hit_initial()), toolbar, "add initial"); addInitial->setToggleButton(TRUE); QWhatsThis::add(addInitial, addinitialText()); addActivityFinal = new QToolButton(*finalButton, TR("New Activity Final"), QString::null, this, SLOT(hit_activityfinal()), toolbar, "add activity final"); addActivityFinal->setToggleButton(TRUE); QWhatsThis::add(addActivityFinal, addactivityfinalText()); addFlowFinal = new QToolButton(*exitpointButton, TR("New Flow Final"), QString::null, this, SLOT(hit_flowfinal()), toolbar, "add flow final"); addFlowFinal->setToggleButton(TRUE); QWhatsThis::add(addFlowFinal, addflowfinalText()); addMerge = new QToolButton(*mergeButton, TR("New Merge"), QString::null, this, SLOT(hit_merge()), toolbar, "add merge"); addMerge->setToggleButton(TRUE); QWhatsThis::add(addMerge, addmergeText()); addDecision = new QToolButton(*decisionButton, TR("New Decision"), QString::null, this, SLOT(hit_decision()), toolbar, "add decision"); addDecision->setToggleButton(TRUE); QWhatsThis::add(addDecision, adddecisionText()); addFork = new QToolButton(*forkButton, TR("New Fork"), QString::null, this, SLOT(hit_fork()), toolbar, "add fork"); addFork->setToggleButton(TRUE); QWhatsThis::add(addFork, addforkText()); addJoin = new QToolButton(*joinButton, TR("New Join"), QString::null, this, SLOT(hit_join()), toolbar, "add join"); addJoin->setToggleButton(TRUE); QWhatsThis::add(addJoin, addjoinText()); addFlow = new QToolButton(*directionalAssociationButton, TR("New Flow"), QString::null, this, SLOT(hit_flow()), toolbar, "add flow"); addFlow->setToggleButton(TRUE); QWhatsThis::add(addFlow, addflowText()); dependency = new QToolButton(*dependencyButton, TR("Dependency"), QString::null, this, SLOT(hit_dependency()), toolbar, "dependency"); dependency->setToggleButton(TRUE); QWhatsThis::add(dependency, dependencyText()); note = new QToolButton(*noteButton, TR("Note"), QString::null, this, SLOT(hit_note()), toolbar, "note"); note->setToggleButton(TRUE); QWhatsThis::add(note, noteText()); anchor = new QToolButton(*anchorButton, TR("Anchor"), QString::null, this, SLOT(hit_anchor()), toolbar, "anchor"); anchor->setToggleButton(TRUE); QWhatsThis::add(anchor, anchorText()); text = new QToolButton(*textButton, TR("Text"), QString::null, this, SLOT(hit_text()), toolbar, "text"); text->setToggleButton(TRUE); QWhatsThis::add(text, textText()); image = new QToolButton(*imageButton, TR("Image"), QString::null, this, SLOT(hit_image()), toolbar, "image"); image->setToggleButton(TRUE); QWhatsThis::add(image, imageText()); toolbar->addSeparator(); add_scale_cmd(toolbar); // view = new ActivityDiagramView(this, canvas, (id != -1) ? id : b->get_ident()); setFocusProxy(view); setCentralWidget(view); //qApp->setMainWidget(this); QWorkspace * w = UmlWindow::get_workspace(); resize((w->width() * 4)/5, (w->height() * 4)/5); /*if (w->windowList().isEmpty()) showMaximized(); else*/ show(); view->preferred_size_zoom(); //qApp->setMainWidget(0); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { isStart = false; isHexWorkspace = true; mAbout = new AboutUi(this); threadBuffer = (unsigned char*) malloc(BUFFER_SIZE); hexBuffer = (char*) malloc(4000); mSerialThread = new SerialThread(threadBuffer,BUFFER_SIZE); numberOfCharacter = 0; temp.reserve(1000); asciiOriginalBuffer.reserve(1000); QPixmap pix = QPixmap(":/MainUi/Start.png"); iconStart = new QIcon(pix); pix = QPixmap(":/MainUi/Stop.png"); iconStop = new QIcon(pix); pix = QPixmap(":/MainUi/Ascii.png"); iconAscii = new QIcon(pix); pix = QPixmap(":/MainUi/Hex.png"); iconHex = new QIcon(pix); pix = QPixmap(":/MainUi/DSR_R.png"); iconDSR_R = new QIcon(pix); pix = QPixmap(":/MainUi/DTR_R.png"); iconDTR_R = new QIcon(pix); pix = QPixmap(":/MainUi/RTS_R.png"); iconRTS_R = new QIcon(pix); pix = QPixmap(":/MainUi/CTS_R.png"); iconCTS_R = new QIcon(pix); pix = QPixmap(":/MainUi/DCD_R.png"); iconDCD_R = new QIcon(pix); pix = QPixmap(":/MainUi/RNG_R.png"); iconRNG_R = new QIcon(pix); pix = QPixmap(":/MainUi/DSR_V.png"); iconDSR_V = new QIcon(pix); pix = QPixmap(":/MainUi/DTR_V.png"); iconDTR_V = new QIcon(pix); pix = QPixmap(":/MainUi/RTS_V.png"); iconRTS_V = new QIcon(pix); pix = QPixmap(":/MainUi/CTS_V.png"); iconCTS_V = new QIcon(pix); pix = QPixmap(":/MainUi/DCD_V.png"); iconDCD_V = new QIcon(pix); pix = QPixmap(":/MainUi/RNG_V.png"); iconRNG_V = new QIcon(pix); mSerialPort = new QComboBox; Utils::setPortComList(mSerialPort); // Setup by setPortComList //mSerialPort->setCurrentIndex(0); mBaudrate = new QComboBox; QStringList baudrate; baudrate << tr("230400") << tr("115200") << tr("57600") << tr("56000") << tr("38400") << tr("28800") << tr("19200") << tr("14400") << tr("9600") << tr("4800") << tr("2400") << tr("1200") << tr("600") << tr("300") << tr("110"); mBaudrate->addItems(baudrate); mBaudrate->setCurrentIndex(1); mStartStop = new QAction(tr("StartStop"), this); mStartStop->setShortcut(tr("Ctrl+Return")); mStartStop->setToolTip(tr("Start communication")); mStartStop->setStatusTip(tr("Start communication")); mStartStop->setWhatsThis(tr("Start communication")); mStartStop->setIcon(*iconStart); mHexAscii = new QAction(tr("HexAscii"), this); mHexAscii->setShortcut(tr("Ctrl+A")); mHexAscii->setToolTip(tr("Change to Ascii workspace")); mHexAscii->setStatusTip(tr("Change to Ascii workspace")); mHexAscii->setWhatsThis(tr("Change to Ascii workspace")); mHexAscii->setIcon(*iconAscii); mClearButton = new QAction(tr("Clear"), this); mClearButton->setShortcut(tr("Ctrl+E")); mClearButton->setToolTip(tr("Clean output ascii and hex")); mClearButton->setStatusTip(tr("Clean output ascii and hex")); mClearButton->setWhatsThis(tr("Clean output ascii and hex")); mClearButton->setIcon( QIcon(QPixmap(":/MainUi/Delete.png"))); mConfigToolbar = addToolBar(tr("Pointer type")); mConfigToolbar->addWidget(mSerialPort); mConfigToolbar->addWidget(mBaudrate); mConfigToolbar->addAction(mStartStop); mConfigToolbar->addAction(mHexAscii); mConfigToolbar->addAction(mClearButton); ui->setupUi(this); connect( mStartStop, SIGNAL(triggered() ), this, SLOT(eventStartStop()) ); connect( mHexAscii, SIGNAL(triggered() ), this, SLOT(eventHexAscii()) ); connect( mClearButton, SIGNAL(triggered() ), this, SLOT(eventClearButton()) ); connect( ui->actionQuit, SIGNAL(triggered() ), this, SLOT(eventQuit()) ); connect( ui->actionAbout, SIGNAL(triggered() ), this, SLOT(eventAbout()) ); connect( ui->actionSaveInputOutput, SIGNAL(triggered() ), this, SLOT(eventSaveInputOutput()) ); connect( ui->actionSaveTerminalContent, SIGNAL(triggered() ), this, SLOT(eventSaveTerminalContent()) ); connect( ui->actionSave_Input_Output, SIGNAL(triggered() ), this, SLOT(eventSaveInputOutput()) ); connect( ui->actionSave_Terminal_Content, SIGNAL(triggered() ), this, SLOT(eventSaveTerminalContent()) ); connect( mSerialPort, SIGNAL(currentIndexChanged(const QString &)),this, SLOT(eventSerialPort())); connect( mBaudrate, SIGNAL(currentIndexChanged(const QString &)),this, SLOT(eventBaudrate())); connect( ui->addOutputFrame, SIGNAL(clicked()), this, SLOT(eventAddOutputFrame())); connect( ui->deleteOutputFrame, SIGNAL(clicked()), this, SLOT(eventDeleteOutputFrame())); connect( ui->sendOutputFrame, SIGNAL(clicked()), this, SLOT(eventSendOutputFrame())); connect( ui->outputTable, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(eventDoubleClickOutputTable(QModelIndex))); connect( ui->addOutputFrameHex, SIGNAL(clicked()), this, SLOT(eventAddOutputFrameHex())); connect( ui->deleteOutputFrameHex, SIGNAL(clicked()), this, SLOT(eventDeleteOutputFrameHex())); connect( ui->sendOutputFrameHex, SIGNAL(clicked()), this, SLOT(eventSendOutputFrameHex())); connect( ui->outputTableHex, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(eventDoubleClickOutputTableHex(QModelIndex))); connect( ui->directAsciiText, SIGNAL(textChanged(QString)), this, SLOT(eventDirectAsciiChanged(QString))); connect( ui->directHexText, SIGNAL(textChanged(QString)), this, SLOT(eventDirectHexChanged(QString))); connect( ui->actionSetDTR, SIGNAL(triggered(bool)), this, SLOT(eventSetDTR(bool))); connect( ui->actionSetRTS, SIGNAL(triggered(bool)), this, SLOT(eventSetRTS(bool))); connect( ui->actionClear_log, SIGNAL(triggered()), this, SLOT(eventClearLog())); connect( ui->actionClear_Ascii_Hex_log, SIGNAL(triggered()), this, SLOT(eventClearAsciiHexLog())); connect( ui->actionClear_Ascii_log, SIGNAL(triggered()), this, SLOT(eventClearAsciiLog())); connect( ui->actionControl_Status, SIGNAL(triggered(bool)), this, SLOT(eventHideControlStatus(bool))); connect( ui->actionActivate_Control_Line, SIGNAL(triggered(bool)), this, SLOT(eventActivateControlLine(bool)) ); connect( ui->actionOutput_Ascii, SIGNAL(triggered(bool)), this, SLOT(eventHideOutputAscii(bool))); connect( ui->actionOutput_Hex, SIGNAL(triggered(bool)), this, SLOT(eventHideOutputHex(bool))); connect( ui->actionLog, SIGNAL(triggered(bool)), this, SLOT(eventHideLog(bool))); connect( ui->actionOpenFrameProject, SIGNAL(triggered()), this, SLOT(eventOpenFrameProject())); ui->terminalOutputHex->setVerticalScrollBar(ui->verticalScrollBar); ui->terminalOutputAscii->setVerticalScrollBar(ui->verticalScrollBar); ui->dockOutputAscii->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable); ui->dockOutputHex->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable); ui->dockLog->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable); QFont font = ui->terminalOutputAscii->font(); #ifdef Q_OS_DARWIN font.setPointSize(14); #else font.setPointSize(10); #endif ui->terminalOutputAscii->setFont(font); ui->terminalOutputHex->setFont(font); ui->terminalOutputAsciiOnly->setFont(font); ui->terminalOutputAsciiOnly->setVisible(false); if (Settings::getFirstStart()==true) { ui->dockLog->setVisible(Settings::getLogStatus()); ui->actionLog->setChecked(Settings::getLogStatus()); ui->dockOutputAscii->setVisible(Settings::getOutputAsciiStatus()); ui->actionOutput_Ascii->setChecked(Settings::getOutputAsciiStatus()); ui->dockOutputHex->setVisible(Settings::getOutputHexStatus()); ui->actionOutput_Hex->setChecked(Settings::getOutputHexStatus()); ui->ControlToolBar->setVisible(Settings::getControlStatus()); ui->actionControl_Status->setChecked(Settings::getControlStatus()); if (Settings::getTerminalStatus()==true) { eventHexAscii(); } } else { Settings::setFirstStart(true); Settings::setControlStatus(true); Settings::setLogStatus(true); Settings::setOutputAsciiStatus(true); Settings::setOutputHexStatus(true); Settings::setTerminalStatus(false); } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), m_transferMenu(new QMenu(tr("Download"), this)), m_packageMenu(new QMenu(tr("Package"), this)), m_addUrlsAction(new QAction(QIcon::fromTheme("general_add"), tr("Add URLs"), this)), m_importUrlsAction(new QAction(QIcon::fromTheme("general_toolbar_folder"), tr("Import URLs"), this)), m_retrieveUrlsAction(new QAction(QIcon::fromTheme("general_search"), tr("Retrieve URLs"), this)), m_clipboardUrlsAction(new QAction(QIcon::fromTheme("general_share"), tr("Clipboard URLs"), this)), m_queueAction(new QAction(QIcon("/etc/hildon/theme/mediaplayer/Play.png"), tr("Start all DLs"), this)), m_pauseAction(new QAction(QIcon("/etc/hildon/theme/mediaplayer/Pause.png"), tr("Pause all DLs"), this)), m_propertiesAction(new QAction(QIcon::fromTheme("general_information"), tr("Properties"), this)), m_transferQueueAction(new QAction(tr("Start"), this)), m_transferPauseAction(new QAction(tr("Pause"), this)), m_transferCancelAction(new QAction(tr("Remove"), this)), m_transferCancelDeleteAction(new QAction(tr("Remove and delete files"), this)), m_packageQueueAction(new QAction(tr("Start"), this)), m_packagePauseAction(new QAction(tr("Pause"), this)), m_packageCancelAction(new QAction(tr("Remove"), this)), m_packageCancelDeleteAction(new QAction(tr("Remove and delete files"), this)), m_settingsAction(new QAction(tr("Settings"), this)), m_pluginsAction(new QAction(tr("Load plugins"), this)), m_aboutAction(new QAction(tr("About"), this)), m_concurrentAction(new ValueSelectorAction(tr("Maximum concurrent DLs"), this)), m_nextAction(new ValueSelectorAction(tr("After current DLs"), this)), m_view(new QTreeView(this)), m_toolBar(new QToolBar(this)), m_activeLabel(new QLabel(QString("%1DLs").arg(TransferModel::instance()->activeTransfers()), this)), m_speedLabel(new QLabel(Utils::formatBytes(TransferModel::instance()->totalSpeed()) + "/s", this)) { setWindowTitle("QDL"); setCentralWidget(m_view); addToolBar(Qt::BottomToolBarArea, m_toolBar); menuBar()->addAction(m_concurrentAction); menuBar()->addAction(m_nextAction); menuBar()->addAction(m_queueAction); menuBar()->addAction(m_pauseAction); menuBar()->addAction(m_settingsAction); menuBar()->addAction(m_pluginsAction); menuBar()->addAction(m_aboutAction); m_addUrlsAction->setShortcut(tr("Ctrl+N")); m_importUrlsAction->setShortcut(tr("Ctrl+O")); m_retrieveUrlsAction->setShortcut(tr("Ctrl+F")); m_propertiesAction->setShortcut(tr("Ctrl+I")); m_propertiesAction->setEnabled(false); m_clipboardUrlsAction->setShortcut(tr("Ctrl+U")); m_pluginsAction->setShortcut(tr("Ctrl+L")); m_transferMenu->addAction(m_transferQueueAction); m_transferMenu->addAction(m_transferPauseAction); m_transferMenu->addAction(m_transferCancelAction); m_transferMenu->addAction(m_transferCancelDeleteAction); m_packageMenu->addAction(m_packageQueueAction); m_packageMenu->addAction(m_packagePauseAction); m_packageMenu->addAction(m_packageCancelAction); m_packageMenu->addAction(m_packageCancelDeleteAction); m_concurrentAction->setModel(new ConcurrentTransfersModel(m_concurrentAction)); m_concurrentAction->setValue(Settings::maximumConcurrentTransfers()); m_nextAction->setModel(new ActionModel(m_nextAction)); m_nextAction->setValue(Settings::nextAction()); QLabel *speedIcon = new QLabel(m_toolBar); speedIcon->setPixmap(QIcon::fromTheme("general_received").pixmap(m_toolBar->iconSize())); QWidget *spacer1 = new QWidget(m_toolBar); spacer1->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); QWidget *spacer2 = new QWidget(m_toolBar); spacer2->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); m_activeLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); m_speedLabel->setMinimumWidth(m_speedLabel->fontMetrics().width("9999.99MB/s")); m_speedLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); m_toolBar->setAllowedAreas(Qt::BottomToolBarArea); m_toolBar->setContextMenuPolicy(Qt::PreventContextMenu); m_toolBar->setMovable(false); m_toolBar->addAction(m_addUrlsAction); m_toolBar->addAction(m_importUrlsAction); m_toolBar->addAction(m_retrieveUrlsAction); m_toolBar->addAction(m_clipboardUrlsAction); m_toolBar->addAction(m_propertiesAction); m_toolBar->addWidget(spacer1); m_toolBar->addWidget(m_activeLabel); m_toolBar->addWidget(spacer2); m_toolBar->addWidget(m_speedLabel); m_toolBar->addWidget(speedIcon); m_view->setModel(TransferModel::instance()); m_view->setSelectionBehavior(QTreeView::SelectRows); m_view->setContextMenuPolicy(Qt::CustomContextMenu); m_view->setEditTriggers(QTreeView::NoEditTriggers); m_view->setExpandsOnDoubleClick(true); m_view->setItemsExpandable(true); m_view->setUniformRowHeights(true); m_view->setAllColumnsShowFocus(true); QHeaderView *header = m_view->header(); if (!header->restoreState(Settings::transferViewHeaderState())) { const QFontMetrics fm = header->fontMetrics(); header->resizeSection(0, 200); header->resizeSection(2, fm.width("999.99MB of 999.99MB (99.99%)")); header->resizeSection(3, fm.width("999.99KB/s")); header->hideSection(1); // Hide priority column } connect(Settings::instance(), SIGNAL(maximumConcurrentTransfersChanged(int)), this, SLOT(onMaximumConcurrentTransfersChanged(int))); connect(Settings::instance(), SIGNAL(nextActionChanged(int)), this, SLOT(onNextActionChanged(int))); connect(TransferModel::instance(), SIGNAL(captchaRequest(TransferItem*)), this, SLOT(showCaptchaDialog(TransferItem*))); connect(TransferModel::instance(), SIGNAL(settingsRequest(TransferItem*)), this, SLOT(showPluginSettingsDialog(TransferItem*))); connect(TransferModel::instance(), SIGNAL(activeTransfersChanged(int)), this, SLOT(onActiveTransfersChanged(int))); connect(TransferModel::instance(), SIGNAL(totalSpeedChanged(int)), this, SLOT(onTotalSpeedChanged(int))); connect(m_transferMenu, SIGNAL(aboutToShow()), this, SLOT(setTransferMenuActions())); connect(m_packageMenu, SIGNAL(aboutToShow()), this, SLOT(setPackageMenuActions())); connect(m_addUrlsAction, SIGNAL(triggered()), this, SLOT(showAddUrlsDialog())); connect(m_importUrlsAction, SIGNAL(triggered()), this, SLOT(showImportUrlsDialog())); connect(m_retrieveUrlsAction, SIGNAL(triggered()), this, SLOT(showRetrieveUrlsDialog())); connect(m_clipboardUrlsAction, SIGNAL(triggered()), this, SLOT(showClipboardUrlsDialog())); connect(m_queueAction, SIGNAL(triggered()), TransferModel::instance(), SLOT(queue())); connect(m_pauseAction, SIGNAL(triggered()), TransferModel::instance(), SLOT(pause())); connect(m_propertiesAction, SIGNAL(triggered()), this, SLOT(showCurrentItemProperties())); connect(m_transferQueueAction, SIGNAL(triggered()), this, SLOT(queueCurrentTransfer())); connect(m_transferPauseAction, SIGNAL(triggered()), this, SLOT(pauseCurrentTransfer())); connect(m_transferCancelAction, SIGNAL(triggered()), this, SLOT(cancelCurrentTransfer())); connect(m_transferCancelDeleteAction, SIGNAL(triggered()), this, SLOT(cancelAndDeleteCurrentTransfer())); connect(m_packageQueueAction, SIGNAL(triggered()), this, SLOT(queueCurrentPackage())); connect(m_packagePauseAction, SIGNAL(triggered()), this, SLOT(pauseCurrentPackage())); connect(m_packageCancelAction, SIGNAL(triggered()), this, SLOT(cancelCurrentPackage())); connect(m_packageCancelDeleteAction, SIGNAL(triggered()), this, SLOT(cancelAndDeleteCurrentPackage())); connect(m_settingsAction, SIGNAL(triggered()), this, SLOT(showSettingsDialog())); connect(m_pluginsAction, SIGNAL(triggered()), this, SLOT(loadPlugins())); connect(m_aboutAction, SIGNAL(triggered()), this, SLOT(showAboutDialog())); connect(m_concurrentAction, SIGNAL(valueChanged(QVariant)), this, SLOT(setMaximumConcurrentTransfers(QVariant))); connect(m_nextAction, SIGNAL(valueChanged(QVariant)), this, SLOT(setNextAction(QVariant))); connect(m_view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint))); connect(m_view->selectionModel(), SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), this, SLOT(onCurrentRowChanged(QModelIndex))); }
FenPrincipale::FenPrincipale() { showMaximized(); //showNormal(); QMenu *menuFichier = menuBar()->addMenu("&Fichier"); QAction *actionLoadImage = menuFichier->addAction("&Load Image"); actionLoadImage->setIcon(QIcon("Icons/fileopen.png")); menuFichier->addAction(actionLoadImage); QAction *actionExit = menuFichier->addAction("&Quitter"); actionExit->setIcon(QIcon("Icons/fileclose.png")); menuFichier->addAction(actionExit); //QMenu *menuTools = menuBar()->addMenu("&Tools"); QMenu *menuComm = menuBar()->addMenu("&Communication"); QAction *actionSend = menuComm->addAction("&Send to server"); actionSend->setIcon(QIcon("Icons/ok.png")); // Création de la barre d'outils QToolBar *toolBarFichier = addToolBar("Fichier"); toolBarFichier->addAction(actionLoadImage); toolBarFichier->addAction(actionExit); toolBarFichier->addSeparator(); toolBarFichier->addAction(actionSend); QObject::connect(actionLoadImage, SIGNAL(triggered()), this, SLOT(LoadImageW())); QObject::connect(actionExit, SIGNAL(triggered()), this, SLOT(close())); QObject::connect(actionSend, SIGNAL(triggered()), this, SLOT(SendServer())); QObject::connect(actionSend, SIGNAL(triggered()), this, SLOT(ShowResults())); // // Création des docks // // dock IMAGE dockImage = new QDockWidget("Image", this); setCentralWidget(dockImage); ImageWidget = new QWidget; dockImage->setWidget(ImageWidget); // dock SERVEUR dockServeur = new QDockWidget("Serveur", this); addDockWidget(Qt::LeftDockWidgetArea, dockServeur); QWidget *paramDock = new QWidget; dockServeur->setWidget(paramDock); QSize s(220,20); adressServer1 = new QLineEdit(QString("138.195.102.25")); adressServer1->setMaximumSize(s); QHBoxLayout *adressLayout = new QHBoxLayout; adressLayout->addWidget(adressServer1); QWidget *adressWidget = new QWidget; adressWidget->setLayout(adressLayout); portAdressServer = new QLineEdit(QString("6006")); portAdressServer->setMaximumSize(s); QHBoxLayout *portLayout = new QHBoxLayout; portLayout->addWidget(portAdressServer); QWidget *portAdressWidget = new QWidget; portAdressWidget->setLayout(portLayout); QLabel *adressLabel = new QLabel("Adresse IP",paramDock); QLabel *portLabel = new QLabel("Port",paramDock); QPushButton *okServer = new QPushButton("Send"); QObject::connect(okServer, SIGNAL(clicked()),this,SLOT(SendServer())); QObject::connect(okServer, SIGNAL(clicked()),this,SLOT(ShowResults())); QVBoxLayout *paramLayout = new QVBoxLayout(paramDock); paramLayout->addWidget(adressLabel); paramLayout->addWidget(adressWidget); paramLayout->addWidget(portLabel); paramLayout->addWidget(portAdressWidget); paramLayout->addWidget(okServer); paramLayout->setAlignment(Qt::AlignLeft); paramDock->setLayout(paramLayout); //dockServeur->setGeometry(QRect(100,200,200,250)); dockServeur->setMaximumSize(250,200); // dock RESULTATS dockResults = new QDockWidget("Resultats",this); addDockWidget(Qt::RightDockWidgetArea, dockResults); dockResults->setMaximumWidth(250); WidgetResults = new QWidget; scrollArea = new QScrollArea; dockResults->setWidget(scrollArea); QPixmap *mini = new QPixmap(QString("test.jpg")); Result R(mini,98,"t"); QPixmap *mini2 = new QPixmap(QString("9143.gif.jpg")); Result R2(mini2,95,"v"); QPixmap *mini3 = new QPixmap(QString("test.jpg")); Result R3(mini3,92,"t"); QPixmap *mini4 = new QPixmap(QString("test.jpg")); Result R4(mini4,90,"t"); QPixmap *mini5 = new QPixmap(QString("test.jpg")); Result R5(mini5,88,"t"); QPixmap *mini6 = new QPixmap(QString("test.jpg")); Result R6(mini6,86,"t"); QPixmap *mini7 = new QPixmap(QString("test.jpg")); Result R7(mini7,84,"t"); QPixmap *mini8 = new QPixmap(QString("test.jpg")); Result R8(mini8,82,"t"); QPixmap *mini9 = new QPixmap(QString("test.jpg")); Result R9(mini9,81,"t"); QPixmap *mini10 = new QPixmap(QString("test.jpg")); Result R10(mini10,79,"t"); QPixmap *mini11 = new QPixmap(QString("test.jpg")); Result R11(mini11,78,"t"); QPixmap *mini12 = new QPixmap(QString("test.jpg")); Result R12(mini12,77,"t"); QPixmap *mini13 = new QPixmap(QString("test.jpg")); Result R13(mini13,76,"t"); QPixmap *mini14 = new QPixmap(QString("test.jpg")); Result R14(mini14,75,"t"); T.push_back(R); T.push_back(R2); T.push_back(R3); T.push_back(R4); T.push_back(R5); T.push_back(R6); T.push_back(R7); T.push_back(R8); T.push_back(R9); T.push_back(R10); T.push_back(R11); T.push_back(R12); T.push_back(R13); T.push_back(R14); }