void DkControlWidget::showCrop(bool visible) { if (visible) { mCropWidget->reset(); switchWidget(mWidgets[crop_widget]); connect(mCropWidget->getToolbar(), SIGNAL(colorSignal(const QBrush&)), mViewport, SLOT(setBackgroundBrush(const QBrush&))); } else
void Settings::addCategorie( const QString& name, SettingsManager::Type type, const QIcon& icon, const QString& label ) { PreferenceWidget *pWidget = new PreferenceWidget( name, type, this ); // We don't want the widget to be visible pWidget->hide(); // Add the widget to the list m_pWidgets.append( pWidget ); // Create a button linked to the widget using its index m_panel->addButton( label, icon, m_pWidgets.indexOf( pWidget ) ); // If this is the first widget, show it by default. if ( m_pWidgets.count() == 1 ) switchWidget( 0 ); }
ViewerWindow::ViewerWindow(QWidget* parent, Qt::WindowFlags flags) : QMainWindow(parent, flags), gameData(nullptr), gameWorld(nullptr), renderer(nullptr) { setMinimumSize(640, 480); QMenuBar* mb = this->menuBar(); QMenu* file = mb->addMenu("&File"); file->addAction("Open &Game", this, SLOT(loadGame())); file->addSeparator(); for(int i = 0; i < MaxRecentGames; ++i) { QAction* r = file->addAction(""); recentGames.append(r); connect(r, SIGNAL(triggered()), SLOT(openRecent())); } recentSep = file->addSeparator(); auto ex = file->addAction("E&xit"); ex->setShortcut(QKeySequence::Quit); connect(ex, SIGNAL(triggered()), QApplication::instance(), SLOT(closeAllWindows())); viewerWidget = new ViewerWidget; viewerWidget->context()->makeCurrent(); glewExperimental = 1; glewInit(); objectViewer = new ObjectViewer(viewerWidget); connect(this, SIGNAL(loadedData(GameWorld*)), objectViewer, SLOT(showData(GameWorld*))); connect(this, SIGNAL(loadedData(GameWorld*)), viewerWidget, SLOT(dataLoaded(GameWorld*))); modelViewer = new ModelViewer(viewerWidget); connect(this, SIGNAL(loadedData(GameWorld*)), modelViewer, SLOT(showData(GameWorld*))); viewSwitcher = new QStackedWidget; viewSwitcher->addWidget(objectViewer); viewSwitcher->addWidget(modelViewer); //connect(objectViewer, SIGNAL(modelChanged(Model*)), modelViewer, SLOT(showModel(Model*))); connect(objectViewer, SIGNAL(showObjectModel(uint16_t)), this, SLOT(showObjectModel(uint16_t))); objectViewer->setViewerWidget( viewerWidget ); QMenu* view = mb->addMenu("&View"); QAction* objectAction = view->addAction("&Object"); QAction* modelAction = view->addAction("&Model"); objectAction->setData(0); modelAction->setData(1); connect(objectAction, SIGNAL(triggered()), this, SLOT(switchWidget())); connect(modelAction, SIGNAL(triggered()), this, SLOT(switchWidget())); QMenu* data = mb->addMenu("&Data"); //data->addAction("Export &Model", objectViewer, SLOT(exportModel())); QMenu* anim = mb->addMenu("&Animation"); anim->addAction("Load &Animations", this, SLOT(openAnimations())); this->setCentralWidget(viewSwitcher); updateRecentGames(); }
void Settings::show() { emit loadSettings(); switchWidget( 0 ); QWidget::show(); }