本文整理汇总了C++中QScrollArea::setAlignment方法的典型用法代码示例。如果您正苦于以下问题:C++ QScrollArea::setAlignment方法的具体用法?C++ QScrollArea::setAlignment怎么用?C++ QScrollArea::setAlignment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QScrollArea
的用法示例。
在下文中一共展示了QScrollArea::setAlignment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QMdiSubWindow
/*!
\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)));
}
示例2: createLabels
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);
}
示例3: QWidget
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()));
}
示例4: QDialog
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);
}
示例5: createPlaylistItem
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);
}
示例6: QWidget
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();
}
}
示例7: VirtualCluster
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();
}
示例8: connect
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();
}*/
}
示例9: addSection
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);
}
示例10: XDialog
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);
}
示例11: QMainWindow
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()));
//.........这里部分代码省略.........
示例12: QWidget
//-----------------------------------------------------------------------------
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();
}
示例13: QMainWindow
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");
//.........这里部分代码省略.........
示例14: createWidgets
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();
//.........这里部分代码省略.........
示例15: createLabels
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;
}