/*! \brief Constructor. Creates a new instance of ProjectWindow. \param pro project data to show, not null. \param parent parent widgets of this window, default value is 0. */ Ui::ProjectWindow::ProjectWindow(Core::Project *pro, QWidget *parent /* = 0 */) : QMdiSubWindow(parent), project(pro) { // entry conditions Q_CHECK_PTR(pro); setAttribute(Qt::WA_DeleteOnClose); setWindowIcon(QIcon(":/proj")); setWindowTitle(project->name()); setMinimumSize(200, 200); // project view, the main widget view = new ProjectView(this); scene = new ProjectScene(project, this); view->setScene(scene); view->setSceneRect(0, 0, project->width(), project->height()); QScrollArea* centerPanel = new QScrollArea(this); centerPanel->viewport()->setStyleSheet(QString("background-color:#C0C0C0")); centerPanel->setAlignment(Qt::AlignCenter); centerPanel->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); centerPanel->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); centerPanel->setWidget(view); // status bar statusBar = new QWidget(this); QHBoxLayout *statusLayout = new QHBoxLayout(statusBar); statusLayout->setMargin(0); statusBar->setLayout(statusLayout); QLineEdit* percentInput = new QLineEdit(statusBar); percentInput->setText("100"); percentInput->setFixedSize(40, 18); QLabel *msgLabel = new QLabel(statusBar); msgLabel->setText("%"); msgLabel->setFixedWidth(8); QPushButton *gridButton = new QPushButton(statusBar); gridButton->setText("#"); gridButton->setCheckable(true); gridButton->setFixedSize(20, 18); QLabel *ctrlLabel = new QLabel(statusBar); ctrlLabel->setFixedWidth(qApp->style()->pixelMetric(QStyle::PM_ScrollBarExtent) - 6); statusLayout->addWidget(percentInput); statusLayout->addWidget(msgLabel); statusLayout->addWidget(gridButton); statusLayout->addWidget(centerPanel->horizontalScrollBar(), 100); statusLayout->addWidget(ctrlLabel); QWidget *mainPanel = new QWidget(this); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->setMargin(0); mainLayout->setSpacing(0); mainLayout->addWidget(centerPanel); mainLayout->addWidget(statusBar); mainPanel->setLayout(mainLayout); setWidget(mainPanel); connect(gridButton, SIGNAL(clicked(bool)), scene, SLOT(showGrid(bool))); connect(appCtx->mainWindow(), SIGNAL(antialiasingChanged(bool)), scene, SLOT(setAntialiasing(bool))); }
void MusicRecommendFoundWidget::createLabels() { delete m_statusLabel; m_statusLabel = nullptr; initFirstWidget(); m_container->show(); layout()->removeWidget(m_mainWindow); QScrollArea *scrollArea = new QScrollArea(this); scrollArea->setStyleSheet(MusicUIObject::MScrollBarStyle01); scrollArea->setWidgetResizable(true); scrollArea->setFrameShape(QFrame::NoFrame); scrollArea->setAlignment(Qt::AlignLeft); scrollArea->setWidget(m_mainWindow); layout()->addWidget(scrollArea); QWidget *function = new QWidget(m_mainWindow); function->setStyleSheet(MusicUIObject::MCheckBoxStyle01 + MusicUIObject::MPushButtonStyle03); QVBoxLayout *grid = new QVBoxLayout(function); QLabel *firstLabel = new QLabel(function); firstLabel->setText(tr("<font color=#158FE1> Recommend Music</font>")); grid->addWidget(firstLabel); QLabel *iconLabel = new QLabel(function); iconLabel->setPixmap(QPixmap(":/image/lb_recmd_daily")); grid->addWidget(iconLabel); //////////////////////////////////////////////////////////////////////////// grid->addWidget(m_container); m_mainWindow->layout()->addWidget(function); }
MusicWebDJRadioCategoryWidget::MusicWebDJRadioCategoryWidget(QWidget *parent) : QWidget(parent) { QHBoxLayout *layout = new QHBoxLayout(this); layout->setSpacing(0); layout->setContentsMargins(0, 0, 0, 0); setLayout(layout); QWidget *mainWindow = new QWidget(this); QScrollArea *scrollArea = new QScrollArea(this); scrollArea->verticalScrollBar()->setStyleSheet(MusicUIObject::MScrollBarStyle01); scrollArea->setWidgetResizable(true); scrollArea->setFrameShape(QFrame::NoFrame); scrollArea->setAlignment(Qt::AlignLeft); scrollArea->setWidget(mainWindow); layout->addWidget(scrollArea); m_gridLayout = new QGridLayout(mainWindow); m_gridLayout->setVerticalSpacing(35); mainWindow->setLayout(m_gridLayout); m_categoryThread = new MusicDJRadioCategoryThread(this); connect(m_categoryThread, SIGNAL(downLoadDataChanged(QString)), SLOT(createCategoryItems())); }
/* * Constructs a image as a child of 'parent', with the * name 'name' and widget flags set to 'f'. * * The dialog will by default be modeless, unless you set 'modal' to * true to construct a modal dialog. */ imageview::imageview(QWidget* parent, const char* name, bool modal, Qt::WFlags fl) : QDialog(parent, name, modal, fl) { setupUi(this); // signals and slots connections connect(_fileList, SIGNAL(clicked()), this, SLOT(sFileList())); connect(_close, SIGNAL(clicked()), this, SLOT(reject())); connect(_save, SIGNAL(clicked()), this, SLOT(sSave())); #ifndef Q_WS_MAC _fileList->setMaximumWidth(25); #endif _imageview = new QLabel(); _imageview->setAlignment(Qt::AlignLeft | Qt::AlignTop); QScrollArea * scrollArea = new QScrollArea(); scrollArea->setWidgetResizable(true); scrollArea->setAlignment(Qt::AlignLeft | Qt::AlignTop); scrollArea->setWidget(_imageview); QHBoxLayout *layout = new QHBoxLayout; layout->setMargin(0); layout->addWidget(scrollArea); _imageFrame->setLayout(layout); }
imageview::imageview(QWidget* parent, const char* name, bool modal, Qt::WFlags fl) : QDialog(parent, fl) { setupUi(this); setObjectName(name ? name : "imageview"); setModal(modal); _save = _buttonBox->button(QDialogButtonBox::Save); _save->setEnabled(false); // signals and slots connections connect(_fileList, SIGNAL(clicked()), this, SLOT(sFileList())); connect(_buttonBox, SIGNAL(accepted()), this, SLOT(sSave())); #ifndef Q_WS_MAC _fileList->setMaximumWidth(25); #endif _imageview = new QLabel(); _imageview->setAlignment(Qt::AlignLeft | Qt::AlignTop); QScrollArea * scrollArea = new QScrollArea(); scrollArea->setWidgetResizable(true); scrollArea->setAlignment(Qt::AlignLeft | Qt::AlignTop); scrollArea->setWidget(_imageview); QHBoxLayout *layout = new QHBoxLayout; layout->setMargin(0); layout->addWidget(scrollArea); _imageFrame->setLayout(layout); shortcuts::setStandardKeys(this); }
void MusicPlaylistFoundWidget::createPlaylistItem(const MusicResultsItem &item) { if(!m_firstInit) { delete m_statusLabel; m_statusLabel = nullptr; m_container->removeWidget(m_mainWindow); QScrollArea *scrollArea = new QScrollArea(this); scrollArea->setStyleSheet(MusicUIObject::MScrollBarStyle01); scrollArea->setWidgetResizable(true); scrollArea->setFrameShape(QFrame::NoFrame); scrollArea->setAlignment(Qt::AlignLeft); scrollArea->setWidget(m_mainWindow); m_container->addWidget(scrollArea); m_firstInit = true; QHBoxLayout *mainlayout = MStatic_cast(QHBoxLayout*, m_mainWindow->layout()); QWidget *containTopWidget = new QWidget(m_mainWindow); QHBoxLayout *containTopLayout = new QHBoxLayout(containTopWidget); containTopLayout->setContentsMargins(30, 0, 30, 0); m_categoryButton = new MusicPlaylistFoundCategoryPopWidget(m_mainWindow); m_categoryButton->setCategory(m_downloadThread->getQueryServer(), this); containTopLayout->addWidget(m_categoryButton); containTopLayout->addStretch(1); foreach(const QString &data, QStringList() << tr("Recommend") << tr("Top") << tr("Hot") << tr("New")) { QLabel *l = new QLabel(data, containTopWidget); l->setStyleSheet(QString("QLabel::hover{%1}").arg(MusicUIObject::MColorStyle08)); QFrame *hline = new QFrame(containTopWidget); hline->setFrameShape(QFrame::VLine); hline->setStyleSheet(MusicUIObject::MColorStyle06); containTopLayout->addWidget(l); containTopLayout->addWidget(hline); } containTopWidget->setLayout(containTopLayout); QFrame *line = new QFrame(m_mainWindow); line->setFrameShape(QFrame::HLine); line->setStyleSheet(MusicUIObject::MColorStyle06); QWidget *containWidget = new QWidget(m_mainWindow); m_gridLayout = new QGridLayout(containWidget); m_gridLayout->setVerticalSpacing(35); containWidget->setLayout(m_gridLayout); mainlayout->addWidget(containTopWidget); mainlayout->addWidget(line); mainlayout->addWidget(containWidget); m_pagingWidgetObject = new MusicPagingWidgetObject(m_mainWindow); connect(m_pagingWidgetObject, SIGNAL(mapped(int)), SLOT(buttonClicked(int))); int total = ceil(m_downloadThread->getPageTotal()*1.0/m_downloadThread->getPageSize()); mainlayout->addWidget(m_pagingWidgetObject->createPagingWidget(m_mainWindow, total)); mainlayout->addStretch(1); }
void ViewletView::defaultVSet(QWidget *parent, QHBoxLayout *FPOLayout) { /* For default viewlet */ comboAccountsList = new QComboBox(); comboAccountsList->addItem(tr("-NA-")); connect(comboAccountsList, SIGNAL(currentIndexChanged(int)), this, SLOT(defaultVUpdate())); /* Add a new QWidget (acts as a container for this viewlet) to the layout of QWidget (QDockWidget>QWidget, i.e, dockwFPO>dockcFPO) in dashboard QMainWindow. */ QWidget *viewletContainer = new QWidget; FPOLayout->addWidget(viewletContainer); /* Set a layout for the container QWidget */ QVBoxLayout *vLay = new QVBoxLayout; viewletContainer->setLayout(vLay); /***** Start of viewlet specific implementations *****/ /* Specification: This default viewlet contains two widgets, 1) An account selection widget, and 2) A scroll area which wraps a QWidget to show the entries.*/ /** @bugid_1 1) Account selection feature of the viewlet */ /* comboAccountsList = new QComboBox(); comboAccountsList->addItem(tr("-NA-")); */ vLay->addWidget(comboAccountsList); /* 2) The actual viewlet display of account selected in 1) */ QWidget *defaultViewletWidget = new QWidget(); defaultVLayout = new QVBoxLayout(); QScrollArea *viewletScrollArea = new QScrollArea(); viewletScrollArea->setWidget(defaultViewletWidget); viewletScrollArea->setAlignment(Qt::AlignLeft); viewletScrollArea->setWidgetResizable(true); defaultViewletWidget->setLayout(defaultVLayout); vLay->addWidget(viewletScrollArea); //create viewlet if(comboAccountsList->currentIndex()) { selectedAccountIndex = comboAccountsList->currentIndex(); selectedAccount = accountsList->at(selectedAccountIndex); viewletModel->defaultVGenerate(selectedAccount); defaultVDraw(); } }
ImageCluster::ImageCluster(QWidget* pParent, const char* pName) : VirtualCluster(pParent, pName) { addNumberWidget(new ImageClusterLineEdit(this, pName)); _image = new QLabel("picture here"); _image->setPixmap(_nullPixmap); _image->setAlignment(Qt::AlignLeft | Qt::AlignTop); QScrollArea * scrollArea = new QScrollArea(); scrollArea->setWidgetResizable(true); scrollArea->setAlignment(Qt::AlignLeft | Qt::AlignTop); scrollArea->setWidget(_image); _grid->addWidget(scrollArea, 1, 0, -1, -1); _description->hide(); _name->hide(); _nullPixmap = QPixmap(); }
GenericHistogramWindow::GenericHistogramWindow(GenericHistogramView* view) : _view(view) { QScrollArea* scrollArea = new QScrollArea(); scrollArea->setWidget(_view); scrollArea->setBackgroundRole(QPalette::Dark); scrollArea->setAlignment(Qt::AlignCenter); initStatusBar(); QVBoxLayout* layout = new QVBoxLayout(); layout->addWidget(_view->getGraphicalHistogram()); layout->addWidget(_statusBar); this->setLayout(layout); connect(_view, SIGNAL(leftClickedValue(int, std::vector<int>)), this, SLOT(showLeftClickedValue(int, std::vector<int>))); connect(_view, SIGNAL(rightClickedValue(int, std::vector<int>)), this, SLOT(showRightClickedValue(int, std::vector<int>))); connect(_view, SIGNAL(hoveredValue(int, std::vector<int>)), this, SLOT(showHoveredValue(int, std::vector<int>))); }
void ViewletView::leftVSet(QWidget *parent, QHBoxLayout *FPOLayout) { connect(this, SIGNAL(fileLoaded()), this, SLOT(leftVLoad())); //connect(comboAccountsList, SIGNAL(currentIndexChanged(int)), // this, SLOT(leftVUpdate())); //not required. remove after cleaning loadAccountsTreeComboBox() comboAccountsList = new QComboBox(); comboAccountsList->addItem(tr("-NA-")); QWidget *viewletContainer = new QWidget; FPOLayout->addWidget(viewletContainer); QVBoxLayout *vLay = new QVBoxLayout; viewletContainer->setLayout(vLay); QLabel *title = new QLabel(tr("Expense")); vLay->addWidget(title); /* The actual viewlet display of account(s) chosen*/ QWidget *defaultViewletWidget = new QWidget(); defaultVLayout = new QVBoxLayout(); QScrollArea *viewletScrollArea = new QScrollArea(); viewletScrollArea->setWidget(defaultViewletWidget); viewletScrollArea->setAlignment(Qt::AlignLeft); viewletScrollArea->setWidgetResizable(true); defaultViewletWidget->setLayout(defaultVLayout); vLay->addWidget(viewletScrollArea); /*//create viewlet if(comboAccountsList->currentIndex()) { selectedAccountIndex = comboAccountsList->currentIndex(); selectedAccount = accountsList->at(selectedAccountIndex); defaultVDraw(); }*/ }
void MenuWidget::addSection(const python::list& section) { QWidget* page = new QWidget(); page->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred); QVBoxLayout* vbox = new QVBoxLayout(); page->setLayout(vbox); buttonList.push_back(vector<QWidget*>()); vector<QWidget*>& buttons = buttonList.back(); int numItems = python::len(section) / 2; for(int j=0; j < numItems; ++j){ // extract a pair of elements const string label = python::extract<string>(section[j*2]); const string function = python::extract<string>(section[j*2+1]); if(function == "#label"){ vbox->addWidget(new QLabel(label.c_str()), 0, Qt::AlignCenter); } else if(label == "#monitor"){ } else { FuncButtonBox* box = new FuncButtonBox(label, function); box->button.sigClicked().connect(boost::bind(&MenuWidget::onButtonClicked, this, buttons.size(), box)); vbox->addWidget(box, 0, Qt::AlignCenter); buttons.push_back(box); } } vbox->addStretch(); QScrollArea* area = new QScrollArea(); area->setWidgetResizable(true); area->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); area->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); area->setAlignment(Qt::AlignHCenter); area->setWidget(page); pageStack.addWidget(area); }
image::image(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) : XDialog(parent, name, modal, fl) { setupUi(this); connect(_fileList, SIGNAL(clicked()), this, SLOT(sFileList())); connect(_buttonBox, SIGNAL(rejected()), this, SLOT(reject())); connect(_buttonBox, SIGNAL(accepted()), this, SLOT(sSave())); #ifndef Q_OS_MAC _fileList->setMaximumWidth(25); #endif _image = new QLabel(); _image->setAlignment(Qt::AlignLeft | Qt::AlignTop); QScrollArea * scrollArea = new QScrollArea(); scrollArea->setWidgetResizable(true); scrollArea->setAlignment(Qt::AlignLeft | Qt::AlignTop); scrollArea->setWidget(_image); QHBoxLayout *layout = new QHBoxLayout; layout->setMargin(0); layout->addWidget(scrollArea); _imageFrame->setLayout(layout); }
TextEdit::TextEdit(QWidget *parent) : QMainWindow(parent) { setToolButtonStyle(Qt::ToolButtonFollowStyle); setupFileActions(); setupEditActions(); setupTextActions(); { // QMenu *helpMenu = new QMenu(tr("Help"), this); // menuBar()->addMenu(helpMenu); // helpMenu->addAction(tr("About"), this, SLOT(about())); // helpMenu->addAction(tr("About &Qt"), qApp, SLOT(aboutQt())); } textEdit = new QTextEdit(this); ////////////////////////////////////////////////// connect(textEdit, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(currentCharFormatChanged(QTextCharFormat))); connect(textEdit, SIGNAL(cursorPositionChanged()), this, SLOT(cursorPositionChanged())); /////////// //setCentralWidget(textEdit); //blank=new Blank(this); //setCentralWidget(blank); //create a transparent canvas and put it on the top of textEdit image =new MyCanvas(900,800,this); textEdit->setFixedSize(QSize(800,800)); textEdit->setBackgroundRole(QPalette::Light); //scrollArea对象的背景色设为Dark image->setFixedSize(QSize(800,800)); image->setStyleSheet(QString::fromUtf8("border:1px solid #000000;")); QScrollArea* scrollArea = new QScrollArea; scrollArea->setFixedSize(QSize(1800,900)); //scrollArea->setWidget(image); //将画布添加到scrollArea中 scrollArea->setBackgroundRole(QPalette::Light); //scrollArea对象的背景色设为Dark //scrollArea->setBackgroundColor(QColor::white); // QStackedLayout *stackedLayout = new QStackedLayout; // stackedLayout->addWidget(image); // stackedLayout->addWidget(textEdit); // stackedLayout->setStackingMode(QStackedLayout::StackAll); QHBoxLayout* hLayout=new QHBoxLayout(); hLayout->addWidget(textEdit); hLayout->addWidget(image); // scrollArea->setLayout(stackedLayout); scrollArea->setLayout(hLayout); //scrollArea->setGeometry(QRect(50,50,800,800)); setCentralWidget(scrollArea); //将scrollArea加入到主窗口的中心区new QPainter(this); scrollArea->setAlignment(Qt::AlignHCenter); //after canvas handle the mouse-drag event, emit it to the edittext for farther handling connect(image,SIGNAL(mouseMoveSig(QMouseEvent*)),this,SLOT(onMouseMove(QMouseEvent*))); //connect(image,SIGNAL(mouseMoveSig(QMouseEvent*)),textEdit,SLOT(mouseMoveEvent(QMouseEvent*))); //connect(image,SIGNAL(mouseMoveSig(QMouseEvent*)),textEdit,SLOT(cursorPositionChanged(QMouseEvent*))); //connect(this,SIGNAL(mouseMoveSig(QMouseEvent*)),image,SLOT(mouseMoveSlot(QMouseEvent*))); //connect(textEdit,SIGNAL(mouseMoveEvent(QMouseEvent*)),image,SLOT(mouseMoveSlot(QMouseEvent*))); // textEdit->setFocus(); setCurrentFileName(QString()); fontChanged(textEdit->font()); colorChanged(textEdit->textColor()); alignmentChanged(textEdit->alignment()); connect(textEdit->document(), SIGNAL(modificationChanged(bool)), actionSave, SLOT(setEnabled(bool))); connect(textEdit->document(), SIGNAL(modificationChanged(bool)), this, SLOT(setWindowModified(bool))); connect(textEdit->document(), SIGNAL(undoAvailable(bool)), actionUndo, SLOT(setEnabled(bool))); connect(textEdit->document(), SIGNAL(redoAvailable(bool)), actionRedo, SLOT(setEnabled(bool))); setWindowModified(textEdit->document()->isModified()); actionSave->setEnabled(textEdit->document()->isModified()); actionUndo->setEnabled(textEdit->document()->isUndoAvailable()); actionRedo->setEnabled(textEdit->document()->isRedoAvailable()); connect(actionUndo, SIGNAL(triggered()), textEdit, SLOT(undo())); connect(actionRedo, SIGNAL(triggered()), textEdit, SLOT(redo())); actionCut->setEnabled(false); actionCopy->setEnabled(false); connect(actionCut, SIGNAL(triggered()), textEdit, SLOT(cut())); connect(actionCopy, SIGNAL(triggered()), textEdit, SLOT(copy())); connect(actionPaste, SIGNAL(triggered()), textEdit, SLOT(paste())); connect(textEdit, SIGNAL(copyAvailable(bool)), actionCut, SLOT(setEnabled(bool))); connect(textEdit, SIGNAL(copyAvailable(bool)), actionCopy, SLOT(setEnabled(bool))); #ifndef QT_NO_CLIPBOARD connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged())); #endif //QString initialFile = ":/data/example.html"; QString initialFile = ":/data/test.txt"; const QStringList args = QCoreApplication::arguments(); if (args.count() == 2) initialFile = args.at(1); if (!load(initialFile)) fileNew(); }
//----------------------------------------------------------------------------- SplashInstaller::SplashInstaller (QWidget *aParent, const char *aName, bool aInit) : QWidget(aParent), mGui(!aInit) { setObjectName(aName); KGlobal::dirs()->addResourceType("ksplashthemes", "data", "ksplash/Themes"); if (!mGui) return; QHBoxLayout* hbox = new QHBoxLayout( this ); hbox->setMargin( 0 ); QVBoxLayout* leftbox = new QVBoxLayout( ); hbox->addLayout( leftbox ); hbox->setStretchFactor( leftbox, 1 ); mThemesList = new ThemeListBox(this); mThemesList->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding ); connect(mThemesList, SIGNAL(currentRowChanged(int)), SLOT(slotSetTheme(int))); connect(mThemesList, SIGNAL(filesDropped(KUrl::List)), SLOT(slotFilesDropped(KUrl::List))); leftbox->addWidget(mThemesList); mBtnNew = new KPushButton( KIcon("get-hot-new-stuff"), i18n("Get New Themes..."), this ); mBtnNew->setToolTip(i18n("Get new themes from the Internet")); mBtnNew->setWhatsThis(i18n("You need to be connected to the Internet to use this action. A dialog will display a list of themes from the http://www.kde.org website. Clicking the Install button associated with a theme will install this theme locally.")); leftbox->addWidget( mBtnNew ); connect(mBtnNew, SIGNAL(clicked()), SLOT(slotNew())); mBtnAdd = new KPushButton( KIcon("document-import"), i18n("Install Theme File..."), this ); mBtnAdd->setToolTip(i18n("Install a theme archive file you already have locally")); mBtnAdd->setWhatsThis(i18n("If you already have a theme archive locally, this button will unpack it and make it available for KDE applications")); leftbox->addWidget( mBtnAdd ); connect(mBtnAdd, SIGNAL(clicked()), SLOT(slotAdd())); mBtnRemove = new KPushButton( KIcon("edit-delete"), i18n("Remove Theme"), this ); mBtnRemove->setToolTip(i18n("Remove the selected theme from your disk")); mBtnRemove->setWhatsThis(i18n("This will remove the selected theme from your disk.")); mBtnRemove->setEnabled( false ); leftbox->addWidget( mBtnRemove ); connect(mBtnRemove, SIGNAL(clicked()), SLOT(slotRemove())); mBtnTest = new KPushButton( KIcon("document-preview"), i18n("Test Theme"), this ); mBtnTest->setToolTip(i18n("Test the selected theme")); mBtnTest->setWhatsThis(i18n("This will test the selected theme.")); mBtnTest->setEnabled( false ); leftbox->addWidget( mBtnTest ); connect(mBtnTest, SIGNAL(clicked()), SLOT(slotTest())); QVBoxLayout* rightbox = new QVBoxLayout( ); hbox->addLayout( rightbox ); hbox->setStretchFactor( rightbox, 3 ); QScrollArea* scrollarea = new QScrollArea(this); scrollarea->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter); mPreview = new QLabel(this); scrollarea->setWidget(mPreview); mPreview->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); mPreview->setMinimumSize(QSize(320,240)); mPreview->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter); rightbox->addWidget(scrollarea); rightbox->setStretchFactor( scrollarea, 3 ); mText = new QTextEdit(this); mText->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); mText->setMinimumSize(mText->sizeHint().width(), 7 * mText->fontMetrics().height()); mText->setReadOnly(true); rightbox->addWidget(mText); rightbox->setStretchFactor( mText, 1 ); readThemesList(); load(); }
StegoFrame::StegoFrame(QWidget* parent) : QMainWindow(parent) { QSplitter *central = new QSplitter(Qt::Vertical); QScrollArea *hscroll = new QScrollArea(); QScrollArea *pscroll = new QScrollArea(); QDomElement stegoDom; model = new StegoModel(); model->addView(this); hw = new HistogramWidget(this, model); pw = new PairWidget(this, model); fdock = new FeatureDock(this, model); cdock = new ConfigDock(hw, pw, this); // gdock = new GraphDock(this); // tdock = new TableDock(this, model); ldial = new LoadDialog(this); hscroll->setWidgetResizable(1); hscroll->setAlignment(Qt::AlignLeft); // hscroll->setBackgroundRole(QPalette::Dark); hscroll->setWidget(hw); pscroll->setWidgetResizable(1); pscroll->setAlignment(Qt::AlignLeft); // pscroll->setBackgroundRole(QPalette::Dark); pscroll->setWidget(pw); central->addWidget(hscroll); central->addWidget(pscroll); // scroll1->setWidget(central); // central->show(); setCentralWidget(central); addDockWidget(Qt::LeftDockWidgetArea, fdock); addDockWidget(Qt::BottomDockWidgetArea, cdock); // addDockWidget(Qt::BottomDockWidgetArea, gdock); // addDockWidget(Qt::BottomDockWidgetArea, tdock); openFeaturesAction = new QAction(tr("Open"), this); loadFeaturesAction = new QAction(tr("Load"), this); openDocAction = new QAction(tr("Open"), this); saveDocAction = new QAction(tr("Save"), this); mmdAction = new QAction(tr("MMDs"), this); svmAction = new QAction(tr("SVM classification"), this); muAction = new QAction(tr("Mus"), this); fdial = new QFileDialog(this); fdial->setFileMode(QFileDialog::ExistingFiles); fdial->setNameFilter(tr("Features (*.fv)")); fdial->setAcceptMode(QFileDialog::AcceptOpen); fdial->setDirectory(tr(".")); docMenu = menuBar()->addMenu(tr("Document")); fileMenu = menuBar()->addMenu(tr("Features")); calcMenu = menuBar()->addMenu(tr("Calculate")); fileMenu->addAction(openFeaturesAction); fileMenu->addAction(loadFeaturesAction); docMenu->addAction(openDocAction); docMenu->addAction(saveDocAction); calcMenu->addAction(muAction); calcMenu->addAction(mmdAction); calcMenu->addAction(svmAction); progress = new QProgressBar(statusBar()); statusLabel = new QLabel(tr("Ready.")); statusBar()->addPermanentWidget(statusLabel, 9); statusBar()->addPermanentWidget(progress, 1); connect(openFeaturesAction, SIGNAL(triggered(bool)), this, SLOT(openCollection())); connect(loadFeaturesAction, SIGNAL(triggered(bool)), ldial, SLOT(open())); connect(saveDocAction, SIGNAL(triggered(bool)), this, SLOT(saveXML())); connect(mmdAction, SIGNAL(triggered(bool)), this, SLOT(calcMMDs())); connect(svmAction, SIGNAL(triggered(bool)), this, SLOT(classify())); connect(muAction, SIGNAL(triggered(bool)), this, SLOT(calcMus())); connect(ldial, SIGNAL(accepted()), this, SLOT(loadFeatures())); document = new QDomDocument(); xmlFile = new QFile("stegodoc.xml"); if (xmlFile->exists()) { openXML(); // if (document->firstChildElement().tagName() != QString("stegosaurus")) // printf("lol \n"); sets = document->firstChildElement().firstChildElement(QString("sets")); if (sets.isNull()) { sets = document->createElement(QString("sets")); stegoDom.appendChild(sets); } mmds = document->firstChildElement().firstChildElement(QString("mmds")); if (sets.isNull()) { sets = document->createElement(QString("mmds")); stegoDom.appendChild(sets); } } else { stegoDom = document->createElement(QString("stegosaurus")); sets = document->createElement(QString("sets")); stegoDom.appendChild(sets); document->appendChild(stegoDom); } setMinimumSize(1280, 720); setWindowTitle("Stegosaurus"); }
void CloudDialog::createWidgets() { QLabel * label = 0; bool isConnected = false; m_amazonProviderWidget = new AmazonProviderWidget(this); m_blankProviderWidget = new BlankProviderWidget(this); m_vagrantProviderWidget = new VagrantProviderWidget(this); // BLANK PAGE QWidget * blankPageWidget = new QWidget(); // LOGIN PAGE QHBoxLayout * mainLoginLayout = new QHBoxLayout; mainLoginLayout->setContentsMargins(QMargins(0,0,0,0)); mainLoginLayout->setSpacing(5); QWidget * loginPageWidget = new QWidget; loginPageWidget->setLayout(mainLoginLayout); // LEFT LOGIN LAYOUT m_leftLoginLayout = new QVBoxLayout(); mainLoginLayout->addLayout(m_leftLoginLayout); label = new QLabel; label->setObjectName("H2"); label->setText("Cloud Resources"); m_leftLoginLayout->addWidget(label,0,Qt::AlignTop | Qt::AlignLeft); m_cloudResourceComboBox = new QComboBox(); m_leftLoginLayout->addWidget(m_cloudResourceComboBox,0,Qt::AlignTop | Qt::AlignLeft); //m_cloudResourceComboBox->addItem(NO_PROVIDER); if(showVagrant()) m_cloudResourceComboBox->addItem(VAGRANT_PROVIDER); m_cloudResourceComboBox->addItem(AMAZON_PROVIDER); isConnected = connect(m_cloudResourceComboBox, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(cloudResourceChanged(const QString &))); OS_ASSERT(isConnected); // LOGIN STACKED WIDGET m_loginStackedWidget = new QStackedWidget(); m_leftLoginLayout->addWidget(m_loginStackedWidget); m_loginStackedWidget->addWidget(m_blankProviderWidget->m_loginWidget); m_loginStackedWidget->addWidget(m_vagrantProviderWidget->m_loginWidget); m_loginStackedWidget->addWidget(m_amazonProviderWidget->m_loginWidget); m_loginStackedWidget->setCurrentIndex(m_blankProviderIdx); // RIGHT LOGIN LAYOUT m_rightLoginLayout = new QVBoxLayout(); mainLoginLayout->addLayout(m_rightLoginLayout); m_legalAgreement = new QLabel; m_legalAgreement->hide(); m_legalAgreement->setWordWrap(true); AWSSettings awsSettings; m_legalAgreement->setText(awsSettings.userAgreementText().c_str()); QScrollArea * scrollArea = new QScrollArea(); scrollArea->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); scrollArea->setFixedWidth(TEXT_WIDTH + 15); scrollArea->setMinimumHeight(TEXT_HEIGHT); scrollArea->setStyleSheet("background-color:transparent;"); scrollArea->setWidget(m_legalAgreement); scrollArea->setWidgetResizable(true); scrollArea->setAlignment(Qt::AlignTop); scrollArea->setFrameShape(QFrame::NoFrame); m_rightLoginLayout->addWidget(scrollArea); m_iAcceptCheckBox = new QCheckBox("I Agree"); m_iAcceptCheckBox->hide(); m_rightLoginLayout->addWidget(m_iAcceptCheckBox,0,Qt::AlignTop | Qt::AlignLeft); m_rightLoginLayout->addSpacing(5); isConnected = connect(m_iAcceptCheckBox, SIGNAL(clicked(bool)), this, SLOT(iAcceptClicked(bool))); OS_ASSERT(isConnected); m_rightLoginLayout->addSpacing(5); // SETTINGS PAGE m_mainSettingsLayout = new QVBoxLayout; m_mainSettingsLayout->setContentsMargins(QMargins(0,0,0,0)); m_mainSettingsLayout->setSpacing(5); QWidget * settingsPageWidget = new QWidget; settingsPageWidget->setLayout(m_mainSettingsLayout); // SETTINGS STACKED WIDGET m_settingsStackedWidget = new QStackedWidget(); m_mainSettingsLayout->addWidget(m_settingsStackedWidget); QWidget * widget = new QWidget(); QHBoxLayout * hLayout = new QHBoxLayout; hLayout->setContentsMargins(QMargins(0,0,0,0)); hLayout->setSpacing(5); widget->setLayout(hLayout); hLayout->addWidget(m_blankProviderWidget->m_leftSettingsWidget); hLayout->addWidget(m_blankProviderWidget->m_rightSettingsWidget); m_settingsStackedWidget->addWidget(widget); widget = new QWidget(); hLayout = new QHBoxLayout; hLayout->setContentsMargins(QMargins(0,0,0,0)); hLayout->setSpacing(5); widget->setLayout(hLayout); hLayout->addWidget(m_vagrantProviderWidget->m_leftSettingsWidget); hLayout->addWidget(m_vagrantProviderWidget->m_rightSettingsWidget); m_settingsStackedWidget->addWidget(widget); widget = new QWidget(); hLayout = new QHBoxLayout; hLayout->setContentsMargins(QMargins(0,0,0,0)); hLayout->setSpacing(5); widget->setLayout(hLayout); hLayout->addWidget(m_amazonProviderWidget->m_leftSettingsWidget); hLayout->addWidget(m_amazonProviderWidget->m_rightSettingsWidget); m_settingsStackedWidget->addWidget(widget); m_settingsStackedWidget->setCurrentIndex(m_blankProviderIdx); // PAGE STACKED WIDGET m_pageStackedWidget = new QStackedWidget(); upperLayout()->addWidget(m_pageStackedWidget); m_blankPageIdx = m_pageStackedWidget->addWidget(blankPageWidget); m_loginPageIdx = m_pageStackedWidget->addWidget(loginPageWidget); m_settingsPageIdx = m_pageStackedWidget->addWidget(settingsPageWidget); m_pageStackedWidget->setCurrentIndex(m_loginPageIdx); // BUTTONS this->okButton()->setText("Save"); this->backButton()->setText("Continue"); this->backButton()->setEnabled(false); this->backButton()->show(); // OS SETTINGS #ifdef Q_OS_MAC setWindowFlags(Qt::FramelessWindowHint); #elif defined(Q_OS_WIN32) setWindowFlags(Qt::WindowCloseButtonHint | Qt::MSWindowsFixedSizeDialogHint); #endif cloudResourceChanged(m_cloudResourceComboBox->currentText()); }
void MusicWebDJRadioInfoWidget::createLabels() { initFirstWidget(); m_container->show(); layout()->removeWidget(m_mainWindow); QScrollArea *scrollArea = new QScrollArea(this); scrollArea->verticalScrollBar()->setStyleSheet(MusicUIObject::MScrollBarStyle01); scrollArea->setWidgetResizable(true); scrollArea->setFrameShape(QFrame::NoFrame); scrollArea->setAlignment(Qt::AlignLeft); scrollArea->setWidget(m_mainWindow); layout()->addWidget(scrollArea); QWidget *function = new QWidget(m_mainWindow); function->setStyleSheet(MusicUIObject::MCheckBoxStyle01 + MusicUIObject::MPushButtonStyle03); QVBoxLayout *grid = new QVBoxLayout(function); QWidget *firstTopFuncWidget = new QWidget(function); QHBoxLayout *firstTopFuncLayout = new QHBoxLayout(firstTopFuncWidget); QLabel *firstLabel = new QLabel(function); firstLabel->setText(tr("<font color=#158FE1> DJRadio > %1 </font>").arg(m_currentPlaylistItem.m_name)); QPushButton *backButton = new QPushButton(tr("Back")); backButton->setFixedSize(90, 30); backButton->setStyleSheet(MusicUIObject::MPushButtonStyle03); backButton->setCursor(QCursor(Qt::PointingHandCursor)); connect(backButton, SIGNAL(clicked()), this, SIGNAL(backToMainMenu())); firstTopFuncLayout->addWidget(firstLabel); firstTopFuncLayout->addWidget(backButton); grid->addWidget(firstTopFuncWidget); //////////////////////////////////////////////////////////////////////////// QWidget *topFuncWidget = new QWidget(function); QHBoxLayout *topFuncLayout = new QHBoxLayout(topFuncWidget); m_iconLabel = new QLabel(topFuncWidget); m_iconLabel->setPixmap(QPixmap(":/image/lb_warning").scaled(180, 180)); m_iconLabel->setFixedSize(210, 180); //////////////////////////////////////////////////////////////////////////// QWidget *topLineWidget = new QWidget(topFuncWidget); QVBoxLayout *topLineLayout = new QVBoxLayout(topLineWidget); topLineLayout->setContentsMargins(10, 5, 5, 0); QLabel *nameLabel = new QLabel(topLineWidget); QFont nameFont = nameLabel->font(); nameFont.setPixelSize(20); nameLabel->setFont(nameFont); nameLabel->setStyleSheet(MusicUIObject::MFontStyle01); nameLabel->setText("-"); QLabel *singerLabel = new QLabel(topLineWidget); singerLabel->setStyleSheet(MusicUIObject::MColorStyle04 + MusicUIObject::MFontStyle03); singerLabel->setText("-"); QLabel *playCountLabel = new QLabel(topLineWidget); playCountLabel->setStyleSheet(MusicUIObject::MColorStyle04 + MusicUIObject::MFontStyle03); QLabel *updateTimeLabel = new QLabel(topLineWidget); updateTimeLabel->setStyleSheet(MusicUIObject::MColorStyle04 + MusicUIObject::MFontStyle03); updateTimeLabel->setText("-"); topLineLayout->addWidget(nameLabel); topLineLayout->addWidget(singerLabel); topLineLayout->addWidget(playCountLabel); topLineLayout->addWidget(updateTimeLabel); topLineWidget->setLayout(topLineLayout); topFuncLayout->addWidget(m_iconLabel); topFuncLayout->addWidget(topLineWidget); topFuncWidget->setLayout(topFuncLayout); grid->addWidget(topFuncWidget); //////////////////////////////////////////////////////////////////////////// QWidget *functionWidget = new QWidget(this); functionWidget->setStyleSheet(MusicUIObject::MPushButtonStyle03); QHBoxLayout *hlayout = new QHBoxLayout(functionWidget); m_songButton = new QPushButton(functionWidget); m_songButton->setText(tr("songItems")); m_songButton->setFixedSize(100, 25); m_songButton->setCursor(QCursor(Qt::PointingHandCursor)); hlayout->addWidget(m_songButton); hlayout->addStretch(1); functionWidget->setLayout(hlayout); QButtonGroup *group = new QButtonGroup(this); group->addButton(m_songButton, 0); connect(group, SIGNAL(buttonClicked(int)), m_container, SLOT(setCurrentIndex(int))); #ifdef Q_OS_UNIX m_songButton->setFocusPolicy(Qt::NoFocus); #endif grid->addWidget(functionWidget); ////////////////////////////////////////////////////////////////////// grid->addWidget(m_container); grid->addStretch(1); function->setLayout(grid); m_mainWindow->layout()->addWidget(function); m_resizeWidgets << nameLabel << singerLabel << playCountLabel << updateTimeLabel; }
MainWidget::MainWidget(QWidget *parent) : QWidget(parent) { //init color palette for variables VariableColorPalette palette(QColor(50,100,200)); preview = new CubeMapPreview(500); loader = new CubeMapLoader(); curveEditor = new CurveEditor(this); curveEditor->setViewScale(0.1,-1); setEditorRange(100); curveEditor->setSnap(1,0); curveEditor->setCurrentFrame(0); //create and init variables CurveVariable * pitch = new CurveVariable("Pitch"); CurveVariable * yaw = new CurveVariable("Yaw"); CurveVariable * roll = new CurveVariable("Roll"); CurveVariable * zoom = new CurveVariable("Zoom"); CurveVariable * fov = new CurveVariable("Fov",180); CurveVariable * frame = new CurveVariable("Cubemap",0); //add variables to key frames watcher KeyFrames * keyFrames = KeyFrames::getInstance(); keyFrames->addVariable(pitch); keyFrames->addVariable(zoom); keyFrames->addVariable(roll); keyFrames->addVariable(fov); keyFrames->addVariable(yaw); keyFrames->addVariable(frame); curveEditor->addVariable(pitch); curveEditor->addVariable(yaw); curveEditor->addVariable(roll); curveEditor->addVariable(zoom); curveEditor->addVariable(fov); curveEditor->addVariable(frame); preview->setPitchVar(pitch); preview->setFovVar(fov); preview->setYawVar(yaw); preview->setRollVar(roll); preview->setZoomVar(zoom); loader->setFrameVar(frame); //setup time line timeLine = new TimeLine(this); //init IO module importExport = new IOWidget(loader, timeLine, this); //let the timeline know that a frame has been keyed/un keyed connect(pitch,SIGNAL(changed(float,float)), timeLine, SLOT(update())); connect(yaw,SIGNAL(changed(float,float)), timeLine, SLOT(update())); connect(roll,SIGNAL(changed(float,float)), timeLine, SLOT(update())); connect(zoom,SIGNAL(changed(float,float)), timeLine, SLOT(update())); connect(fov,SIGNAL(changed(float,float)), timeLine, SLOT(update())); connect(frame,SIGNAL(changed(float,float)), timeLine, SLOT(update())); //update preview when cube map changes connect(loader,SIGNAL(faceChanged(QImage *,CubeFace)),preview,SLOT(setFace(QImage *, CubeFace))); //tells the cube map loader to load the cube map corresponding to the new frame connect(timeLine,SIGNAL(frameChanged(float)),loader,SLOT(variablesValues(float))); //tells the preview to display a new frame connect(timeLine,SIGNAL(frameChanged(float)),preview,SLOT(variablesValues(float))); //update the frame cursor of the curve editor connect(timeLine,SIGNAL(frameChanged(float)),curveEditor,SLOT(setCurrentFrame(float))); //Change the range of frames displayed by the curvor editor when the number of frames changes connect(timeLine,SIGNAL(frameNumberChanged(int)), this, SLOT(setEditorRange(int))); //Refresh preview when curves have been edited connect(curveEditor,SIGNAL(curvesChanged(float, float)),preview,SLOT(refreshVariablesValues(float, float))); //connect(timeLine,SIGNAL(frameChanged(float)),preview,SLOT(refresh())); //stop playback if the user interacts with the preview connect(preview,SIGNAL(previewChanged()),timeLine,SLOT(stop())); QTabWidget * tabWidget = new QTabWidget(this); tabWidget->addTab(loader,"Cube&map"); tabWidget->addTab(curveEditor,"Curve &Editor"); tabWidget->addTab(importExport,"E&xport"); QScrollArea * previewScroll = new QScrollArea(this); previewScroll->setWidget(preview); previewScroll->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); QPalette pal = previewScroll->palette(); pal.setColor(QPalette::Background,Qt::black); previewScroll->setPalette(pal); QScrollArea * tabScroll = new QScrollArea(this); tabScroll->setWidget(tabWidget); //so the content will expand if possible tabScroll->setWidgetResizable(true); QSplitter * splitterH = new QSplitter(Qt::Horizontal); splitterH->addWidget(previewScroll); splitterH->addWidget(tabScroll); //splitterH->addWidget(tabWidget); //splitterH->setStretchFactor(0,1); splitterH->setStretchFactor(1,1); QSplitter * splitterV = new QSplitter(Qt::Vertical); splitterV->addWidget(splitterH); splitterV->addWidget(timeLine); splitterV->setStretchFactor(0,1); QGridLayout * gridLayout = new QGridLayout(); gridLayout->addWidget(splitterV,0,0); setLayout(gridLayout); //load settings readSettings(); }