本文整理汇总了C++中QScrollArea::setWidget方法的典型用法代码示例。如果您正苦于以下问题:C++ QScrollArea::setWidget方法的具体用法?C++ QScrollArea::setWidget怎么用?C++ QScrollArea::setWidget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QScrollArea
的用法示例。
在下文中一共展示了QScrollArea::setWidget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addTab
void addTab(std::string tabName, ImageStorage* imgstore, Ui::MainWindow *ui)
{
/*ui->processBtn->setEnabled(true);
ui->previousBtn->setEnabled(true);*/
QWidget *tab = new QWidget();
QString qname = QString::fromStdString(tabName);
tab->setObjectName(qname);
QHBoxLayout *horizontalLayout = new QHBoxLayout(tab);
horizontalLayout->setSpacing(6);
horizontalLayout->setContentsMargins(11, 11, 11, 11);
horizontalLayout->setObjectName(QStringLiteral("horizontalLayout"));
QScrollArea * scrollArea = new QScrollArea(tab);
scrollArea->setObjectName(QStringLiteral("scrollArea"));
scrollArea->setWidgetResizable(true);
QWidget * scrollAreaWidgetContents = new QWidget();
scrollAreaWidgetContents->setObjectName(QStringLiteral("scrollAreaWidgetContents"));
scrollAreaWidgetContents->setGeometry(QRect(0, 0, 492, 447));
QHBoxLayout* horizontalLayout_13 = new QHBoxLayout(scrollAreaWidgetContents);
horizontalLayout->setSpacing(6);
horizontalLayout_13->setContentsMargins(11, 11, 11, 11);
horizontalLayout_13->setObjectName(QStringLiteral("horizontalLayout_13"));
QLabel* label = new QLabel(scrollAreaWidgetContents);
std::string stmp = tabName;
stmp.append("_label");
QString qname2 = QString::fromStdString(stmp);
label->setObjectName(qname2);
QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Expanding);
sizePolicy2.setHorizontalStretch(0);
sizePolicy2.setVerticalStretch(0);
sizePolicy2.setHeightForWidth(label->sizePolicy().hasHeightForWidth());
label->setSizePolicy(sizePolicy2);
horizontalLayout_13->addWidget(label);
scrollArea->setWidget(scrollAreaWidgetContents);
horizontalLayout->addWidget(scrollArea);
ui->imageTab->addTab(tab, QString());
std::string tmp1 = tabName.c_str();
const char* tmp2 = tmp1.c_str();
ui->imageTab->setTabText(ui->imageTab->indexOf(tab), QApplication::translate("MainWindow", tmp2, 0));
ui->imageTab->setCurrentIndex(ui->imageTab->indexOf(tab));
//-------------------------
//---------------------
//display image
cv::Mat image = std::get<1>(imgstore->getCurrent()->second);
QImage img;
if(image.channels() == 3) // RGB image
{
//cvtColor(image, image, CV_BGR2RGB);
img = QImage((const uchar*)(image.data), //(const unsigned char*)
image.cols, image.rows,
image.cols*image.channels(),
QImage::Format_RGB888);
}else // gray image
{
img = QImage((const uchar*)(image.data),
image.cols, image.rows,
image.cols*image.channels(),
QImage::Format_Indexed8);
}
if (!img.isNull())
{
label->setPixmap(QPixmap::fromImage(img));
label->resize(label->pixmap()->size());
label->setAlignment(Qt::AlignCenter);
label->show();
}
else
{
ASSERT(0);
}
//---------------------
}
示例2: QWidget
//.........这里部分代码省略.........
QPalette p = ui->topHits->palette();
p.setColor( QPalette::Text, TomahawkStyle::PAGE_TRACKLIST_TRACK_SOLVED );
p.setColor( QPalette::BrightText, TomahawkStyle::PAGE_TRACKLIST_TRACK_UNRESOLVED );
p.setColor( QPalette::Foreground, TomahawkStyle::PAGE_TRACKLIST_NUMBER );
p.setColor( QPalette::Highlight, TomahawkStyle::PAGE_TRACKLIST_HIGHLIGHT );
p.setColor( QPalette::HighlightedText, TomahawkStyle::PAGE_TRACKLIST_HIGHLIGHT_TEXT );
ui->topHits->setPalette( p );
TomahawkStyle::stylePageFrame( ui->topHits );
TomahawkStyle::stylePageFrame( ui->trackFrame );
}
{
QFont f = ui->biography->font();
f.setFamily( "Titillium Web" );
QPalette p = ui->biography->palette();
p.setColor( QPalette::Text, TomahawkStyle::HEADER_TEXT );
ui->biography->setFont( f );
ui->biography->setPalette( p );
ui->biography->setOpenLinks( false );
ui->biography->setOpenExternalLinks( true );
ui->biography->document()->setDefaultStyleSheet( QString( "a { text-decoration: none; font-weight: bold; color: %1; }" ).arg( TomahawkStyle::HEADER_LINK.name() ) );
TomahawkStyle::stylePageFrame( ui->biography );
TomahawkStyle::styleScrollBar( ui->biography->verticalScrollBar() );
connect( ui->biography, SIGNAL( anchorClicked( QUrl ) ), SLOT( onBiographyLinkClicked( QUrl ) ) );
}
{
QFont f = ui->artistLabel->font();
f.setFamily( "Titillium Web" );
QPalette p = ui->artistLabel->palette();
p.setColor( QPalette::Foreground, TomahawkStyle::HEADER_LABEL );
ui->artistLabel->setFont( f );
ui->artistLabel->setPalette( p );
}
{
QFont f = ui->label->font();
f.setFamily( "Pathway Gothic One" );
QPalette p = ui->label->palette();
p.setColor( QPalette::Foreground, TomahawkStyle::PAGE_CAPTION );
ui->label->setFont( f );
ui->label_2->setFont( f );
ui->label->setPalette( p );
ui->label_2->setPalette( p );
}
{
QFont f = ui->albumLabel->font();
f.setFamily( "Pathway Gothic One" );
QPalette p = ui->albumLabel->palette();
p.setColor( QPalette::Foreground, TomahawkStyle::HEADER_TEXT );
ui->albumLabel->setFont( f );
ui->albumLabel->setPalette( p );
}
{
QScrollArea* area = new QScrollArea();
area->setWidgetResizable( true );
area->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
area->setWidget( widget );
QPalette pal = palette();
pal.setBrush( backgroundRole(), TomahawkStyle::HEADER_BACKGROUND );
area->setPalette( pal );
area->setAutoFillBackground( true );
area->setFrameShape( QFrame::NoFrame );
area->setAttribute( Qt::WA_MacShowFocusRect, 0 );
QVBoxLayout* layout = new QVBoxLayout();
layout->addWidget( area );
setLayout( layout );
TomahawkUtils::unmarginLayout( layout );
}
{
QPalette pal = palette();
pal.setBrush( backgroundRole(), TomahawkStyle::PAGE_BACKGROUND );
ui->widget->setPalette( pal );
ui->widget->setAutoFillBackground( true );
}
MetaPlaylistInterface* mpl = new MetaPlaylistInterface();
mpl->addChildInterface( ui->relatedArtists->playlistInterface() );
mpl->addChildInterface( ui->topHits->playlistInterface() );
mpl->addChildInterface( ui->albums->playlistInterface() );
m_plInterface = playlistinterface_ptr( mpl );
load( artist );
}
示例3: clicked
HelpPanel::HelpPanel(QWidget * parent)
: QFrame(parent)
{
class PrivateSubscriberClose
: public QObject
, private SubscribablePushButton::Subscriber
{
public:
~PrivateSubscriberClose()
{
}
PrivateSubscriberClose(SubscribablePushButton * pushButton)
: QObject(pushButton)
, SubscribablePushButton::Subscriber(pushButton)
{
}
private:
void clicked(bool checked)
{
MainWindow::instance().showFrame(MainWindow::MainFrameIndex);
}
};
QBoxLayout * topLayout = new QVBoxLayout();
setLayout(topLayout);
QFormLayout * formLayout = new QFormLayout();
QFrame * buttonsWidget = new QFrame(NULL);
buttonsWidget->setLayout(formLayout);
buttonsWidget->setObjectName("helpButtonsWidget");
buttonsWidget->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
SubscribablePushButton * moveShipButton = new SubscribablePushButton(NULL, tr("M"));
moveShipButton->setObjectName("move");
SubscribablePushButton * colonizeButton = new SubscribablePushButton(NULL, tr("C"));
colonizeButton->setObjectName("colonize");
SubscribablePushButton * loadButton = new SubscribablePushButton(NULL, tr("L"));
loadButton->setObjectName("load");
SubscribablePushButton * unloadButton = new SubscribablePushButton(NULL, tr("U"));
unloadButton->setObjectName("unload");
SubscribablePushButton * buildShipButton = new SubscribablePushButton(NULL, tr("B.."));
buildShipButton->setObjectName("build");
SubscribablePushButton * nextTurnButton = new SubscribablePushButton(NULL, tr("T"));
nextTurnButton->setObjectName("turn");
SubscribablePushButton * shipDesignButton = new SubscribablePushButton(NULL, tr("D.."));
shipDesignButton->setObjectName("design");
SubscribablePushButton * researchButton = new SubscribablePushButton(NULL, tr("R.."));
researchButton->setObjectName("research");
SubscribablePushButton * newButton = new SubscribablePushButton(NULL, tr("N.."));
newButton->setObjectName("new");
SubscribablePushButton * openButton = new SubscribablePushButton(NULL, tr("O.."));
openButton->setObjectName("open");
SubscribablePushButton * saveButton = new SubscribablePushButton(NULL, tr("S.."));
saveButton->setObjectName("save");
SubscribablePushButton * quitButton = new SubscribablePushButton(NULL, tr("Q"));
quitButton->setObjectName("quit");
SubscribablePushButton * helpButton = new SubscribablePushButton(NULL, tr("H.."));
helpButton->setObjectName("help");
SubscribablePushButton * setupButton = new SubscribablePushButton(NULL, tr("S.."));
setupButton->setObjectName("setup");
SubscribablePushButton * flagButton = new SubscribablePushButton(NULL, tr("F"));
flagButton->setObjectName("flag");
formLayout->addRow(newButton, new QLabel("Start a new game."));
formLayout->addRow(openButton, new QLabel("Open a saved game."));
formLayout->addRow(saveButton, new QLabel("Save current game."));
formLayout->addRow(quitButton, new QLabel("Quit the program."));
formLayout->addRow(helpButton, new QLabel("This help panel."));
formLayout->addRow(setupButton, new QLabel("Setup panel."));
formLayout->addRow(flagButton, new QLabel("Center map on your home system."));
formLayout->addRow(moveShipButton, new QLabel("Move selected ship."));
formLayout->addRow(loadButton, new QLabel("Load population from planet to selected ship."));
formLayout->addRow(unloadButton, new QLabel("Unload population from selected ship to planet."));
formLayout->addRow(colonizeButton, new QLabel("Order selected ship to colonize planet."));
formLayout->addRow(buildShipButton, new QLabel("Create a build order for an existing ship design."));
formLayout->addRow(shipDesignButton, new QLabel("Create a new ship design."));
formLayout->addRow(researchButton, new QLabel("Research new technologies."));
formLayout->addRow(nextTurnButton, new QLabel("Advance time by one month."));
QScrollArea * scrollArea = new QScrollArea();
scrollArea->setWidget(buttonsWidget);
scrollArea->setWidgetResizable(true);
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
scrollArea->setObjectName("helpButtonsScrollArea");
topLayout->addWidget(scrollArea);
QsKineticScroller * kineticScroller = new QsKineticScroller(scrollArea);
kineticScroller->enableKineticScrollFor(scrollArea);
QBoxLayout * buttonLayout = new QHBoxLayout();
topLayout->addItem(buttonLayout);
SubscribablePushButton * closeButton = new SubscribablePushButton(this, tr("Close"));
closeButton->setObjectName("closeButton");
new PrivateSubscriberClose(closeButton);
//.........这里部分代码省略.........
示例4: QMainWindow
WindowMain::WindowMain(QWidget *parent)
: QMainWindow(parent)
{
importer = new OracleImporter(QDesktopServices::storageLocation(QDesktopServices::DataLocation), this);
nam = new QNetworkAccessManager(this);
checkBoxLayout = new QVBoxLayout;
QWidget *checkboxFrame = new QWidget;
checkboxFrame->setLayout(checkBoxLayout);
QScrollArea *checkboxArea = new QScrollArea;
checkboxArea->setWidget(checkboxFrame);
checkboxArea->setWidgetResizable(true);
checkAllButton = new QPushButton(tr("&Check all"));
connect(checkAllButton, SIGNAL(clicked()), this, SLOT(actCheckAll()));
uncheckAllButton = new QPushButton(tr("&Uncheck all"));
connect(uncheckAllButton, SIGNAL(clicked()), this, SLOT(actUncheckAll()));
QHBoxLayout *checkAllButtonLayout = new QHBoxLayout;
checkAllButtonLayout->addWidget(checkAllButton);
checkAllButtonLayout->addWidget(uncheckAllButton);
startButton = new QPushButton(tr("&Start download"));
connect(startButton, SIGNAL(clicked()), this, SLOT(actStart()));
QVBoxLayout *settingsLayout = new QVBoxLayout;
settingsLayout->addWidget(checkboxArea);
settingsLayout->addLayout(checkAllButtonLayout);
settingsLayout->addWidget(startButton);
totalLabel = new QLabel(tr("Total progress:"));
totalProgressBar = new QProgressBar;
nextSetLabel1 = new QLabel(tr("Current file:"));
nextSetLabel2 = new QLabel;
fileLabel = new QLabel(tr("Progress:"));
fileProgressBar = new QProgressBar;
messageLog = new QTextEdit;
messageLog->setReadOnly(true);
QGridLayout *grid = new QGridLayout;
grid->addWidget(totalLabel, 0, 0);
grid->addWidget(totalProgressBar, 0, 1);
grid->addWidget(nextSetLabel1, 1, 0);
grid->addWidget(nextSetLabel2, 1, 1);
grid->addWidget(fileLabel, 2, 0);
grid->addWidget(fileProgressBar, 2, 1);
grid->addWidget(messageLog, 3, 0, 1, 2);
QHBoxLayout *mainLayout = new QHBoxLayout;
mainLayout->addLayout(settingsLayout, 6);
mainLayout->addSpacing(10);
mainLayout->addLayout(grid, 10);
QWidget *centralWidget = new QWidget;
centralWidget->setLayout(mainLayout);
setCentralWidget(centralWidget);
connect(importer, SIGNAL(setIndexChanged(int, int, const QString &)), this, SLOT(updateTotalProgress(int, int, const QString &)));
connect(importer, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateFileProgress(int, int)));
aLoadSetsFile = new QAction(tr("Load sets information from &file..."), this);
connect(aLoadSetsFile, SIGNAL(triggered()), this, SLOT(actLoadSetsFile()));
aDownloadSetsFile = new QAction(tr("&Download sets information..."), this);
connect(aDownloadSetsFile, SIGNAL(triggered()), this, SLOT(actDownloadSetsFile()));
aExit = new QAction(tr("E&xit"), this);
connect(aExit, SIGNAL(triggered()), this, SLOT(close()));
fileMenu = menuBar()->addMenu(tr("&File"));
fileMenu->addAction(aLoadSetsFile);
fileMenu->addAction(aDownloadSetsFile);
fileMenu->addSeparator();
fileMenu->addAction(aExit);
setWindowTitle(tr("Oracle importer"));
setMinimumSize(750, 500);
QStringList args = qApp->arguments();
if (args.contains("-dlsets"))
downloadSetsFile(defaultSetsUrl);
statusLabel = new QLabel;
statusBar()->addWidget(statusLabel);
statusLabel->setText(tr("Sets data not loaded."));
}
示例5: file
PluginSettingsTab::PluginSettingsTab(QWidget *parent) :
QWidget(parent),
m_model(new PluginSettingsModel(this)),
m_view(new QListView(this)),
m_stack(new QStackedWidget(this))
{
m_view->setModel(m_model);
m_view->setMaximumWidth(200);
m_view->setFocus(Qt::OtherFocusReason);
m_stack->setFrameStyle(QFrame::NoFrame);
for (int i = 0; i < m_model->rowCount(); i++) {
QScrollArea *scrollArea = new QScrollArea(this);
QWidget *scrollWidget = new QWidget(scrollArea);
QVBoxLayout *vbox = new QVBoxLayout(scrollWidget);
scrollArea->setWidgetResizable(true);
scrollArea->setWidget(scrollWidget);
QFile file(m_model->data(m_model->index(i), PluginSettingsModel::FileNameRole).toString());
file.open(QIODevice::ReadOnly);
QXmlStreamReader reader;
reader.setDevice(&file);
while (reader.readNext() != QXmlStreamReader::Invalid) {
if ((reader.isStartElement()) || (reader.isEndElement())) {
break;
}
}
QString title = reader.attributes().value("title").toString();
while (!reader.atEnd()) {
if (!reader.attributes().isEmpty()) {
if (reader.name() == "group") {
vbox->addWidget(new SeparatorLabel(reader.attributes().value("title").toString(), this));
}
else if (reader.name() == "list") {
QLabel *label = new QLabel(reader.attributes().value("title").toString() + ":", this);
PluginSettingsCombobox *combobox = new PluginSettingsCombobox(this);
combobox->setKey(QString("%1/%2").arg(title).arg(reader.attributes().value("key").toString()));
combobox->setDefaultValue(reader.attributes().value("default").toString());
while (reader.readNext() != QXmlStreamReader::Invalid) {
if ((reader.isStartElement()) || (reader.isEndElement())) {
break;
}
}
while (reader.name() == "element") {
if (!reader.attributes().isEmpty()) {
combobox->addItem(reader.attributes().value("name").toString(), reader.attributes().value("value").toString());
}
while (reader.readNext() != QXmlStreamReader::Invalid) {
if ((reader.isStartElement()) || (reader.isEndElement())) {
break;
}
}
}
combobox->load();
vbox->addWidget(label);
vbox->addWidget(combobox);
}
else if (reader.name() == "boolean") {
PluginSettingsCheckbox *checkbox = new PluginSettingsCheckbox(this);
checkbox->setText(reader.attributes().value("title").toString());
checkbox->setKey(QString("%1/%2").arg(title).arg(reader.attributes().value("key").toString()));
checkbox->setDefaultValue(reader.attributes().value("default").toString());
checkbox->load();
vbox->addWidget(checkbox);
}
else if (reader.name() == "integer") {
PluginSettingsSpinbox *spinbox = new PluginSettingsSpinbox(this);
spinbox->setKey(QString("%1/%2").arg(title).arg(reader.attributes().value("key").toString()));
spinbox->setDefaultValue(reader.attributes().value("default").toString());
spinbox->setMinimum(reader.attributes().value("min").toString().toInt());
spinbox->setMaximum(reader.attributes().value("max").toString().toInt());
spinbox->load();
vbox->addWidget(new QLabel(reader.attributes().value("title").toString() + ":", this));
vbox->addWidget(spinbox);
}
else if (reader.name() == "text") {
PluginSettingsLineEdit *lineEdit = new PluginSettingsLineEdit(this);
lineEdit->setKey(QString("%1/%2").arg(title).arg(reader.attributes().value("key").toString()));
lineEdit->setDefaultValue(reader.attributes().value("default").toString());
lineEdit->load();
vbox->addWidget(new QLabel(reader.attributes().value("title").toString() + ":", this));
vbox->addWidget(lineEdit);
}
}
while (reader.readNext() != QXmlStreamReader::Invalid) {
if ((reader.isStartElement()) || (reader.isEndElement())) {
break;
}
}
}
//.........这里部分代码省略.........
示例6: QWidget
SettingsTabThumbnail::SettingsTabThumbnail(QWidget *parent, QMap<QString, QVariant> set, bool v) : QWidget(parent) {
// The global settings
globSet = set;
this->setObjectName("tabthumb");
verbose = v;
// Opening the thumbnail database
db = QSqlDatabase::database("thumbDB");
// Style the widget
this->setStyleSheet("#tabthumb { background: transparent; color: white; }");
tabs = new TabWidget;
tabs->expand(false);
tabs->setBorderTop("rgba(150,150,150,100)",2);
tabs->setBorderBot("rgba(150,150,150,100)",2);
QVBoxLayout *mainLay = new QVBoxLayout;
mainLay->addWidget(tabs);
this->setLayout(mainLay);
// the main scroll widget for all LOOK content
scrollbarLook = new CustomScrollbar;
QScrollArea *scrollLook = new QScrollArea;
QVBoxLayout *layLook = new QVBoxLayout(scrollLook);
QWidget *scrollWidgLook = new QWidget(scrollLook);
scrollWidgLook->setLayout(layLook);
scrollLook->setWidget(scrollWidgLook);
scrollLook->setWidgetResizable(true);
scrollLook->setVerticalScrollBar(scrollbarLook);
// the main scroll widget for all FEEL content
scrollbarTune = new CustomScrollbar;
QScrollArea *scrollTune = new QScrollArea;
QVBoxLayout *layTune = new QVBoxLayout(scrollTune);
QWidget *scrollWidgTune = new QWidget(scrollTune);
scrollWidgTune->setLayout(layTune);
scrollTune->setWidget(scrollWidgTune);
scrollTune->setWidgetResizable(true);
scrollTune->setVerticalScrollBar(scrollbarTune);
tabLook = new QWidget;
tabTune = new QWidget;
QVBoxLayout *scrollLayLook = new QVBoxLayout;
scrollLayLook->addWidget(scrollLook);
tabLook->setLayout(scrollLayLook);
QVBoxLayout *scrollLayTune = new QVBoxLayout;
scrollLayTune->addWidget(scrollTune);
tabTune->setLayout(scrollLayTune);
tabs->addTab(tabLook,tr("Look"));
tabs->addTab(tabTune,tr("Fine-Tuning"));
// The titles
CustomLabel *titleLook = new CustomLabel("<center><h1>" + tr("Thumbnail Look") + "</h1></center>");
layLook->addWidget(titleLook);
layLook->addSpacing(20);
CustomLabel *titleTune = new CustomLabel("<center><h1>" + tr("Fine-Tuning of Thumbnails") + "</h1></center>");
layTune->addWidget(titleTune);
layTune->addSpacing(20);
// OPTION TO CHANGE THUMBNAIL SIZE
CustomLabel *thumbSizeLabel = new CustomLabel("<b><span style=\"font-size: 12pt\">" + tr("Thumbnail Size") + "</span></b><br><br>" + tr("Here you can adjust the thumbnail size. You can set it to any size between 20 and 256 pixel. Per default it is set to 80 pixel, but with different screen resolutions it might be nice to have them larger/smaller."));
thumbSizeLabel->setWordWrap(true);
QHBoxLayout *thumbSizeLay = new QHBoxLayout;
thumbSizeSlider = new CustomSlider;
thumbSizeSlider->setMinimum(20);
thumbSizeSlider->setMaximum(256);
thumbSizeSpin = new CustomSpinBox;
thumbSizeSpin->setMinimum(20);
thumbSizeSpin->setMaximum(256);
thumbSizeLay->addStretch();
thumbSizeLay->addWidget(thumbSizeSlider);
thumbSizeLay->addWidget(thumbSizeSpin);
thumbSizeLay->addStretch();
layLook->addWidget(thumbSizeLabel);
layLook->addSpacing(5);
layLook->addLayout(thumbSizeLay);
layLook->addSpacing(20);
connect(thumbSizeSlider, SIGNAL(valueChanged(int)), thumbSizeSpin, SLOT(setValue(int)));
connect(thumbSizeSpin, SIGNAL(valueChanged(int)), thumbSizeSlider, SLOT(setValue(int)));
// OPTION TO SET SPACING BETWEEN THUMBNAILS
borderAroundSlider = new CustomSlider;
borderAroundSlider->setMinimum(0);
borderAroundSlider->setMaximum(30);
borderAroundSlider->setTickInterval(4);
borderAroundSpin = new CustomSpinBox;
borderAroundSpin->setMinimum(0);
//.........这里部分代码省略.........
示例7: QWidget
AdvancedScriptManager::AdvancedScriptManager(QWidget* parent) : QWidget(parent) {
QHBoxLayout* hLayout = new QHBoxLayout(this);
setLayout(hLayout);
QVBoxLayout* vLayout2 = new QVBoxLayout(this);
hLayout->addLayout(vLayout2);
lstCategories = new QListWidget;
lstCategories->setMaximumSize(200,9999);
lstCategories->setMinimumSize(0,0);
vLayout2->addWidget(lstCategories);
addScript = new KPushButton;
addScript->setText("Add Script");
vLayout2->addWidget(addScript);
manageCategories = new KPushButton;
manageCategories->setText("Manage Categories");
vLayout2->addWidget(manageCategories);
QVBoxLayout* vLayout = new QVBoxLayout(this);
hLayout->addLayout(vLayout);
tblScript = new QTableWidget;
if (tblScript->columnCount() < 7)
tblScript->setColumnCount(7);
tblScript->verticalHeader()->hide();
tblScript->setSelectionBehavior(QAbstractItemView::SelectRows);
vLayout->addWidget(tblScript);
tabDetails = new QTabWidget;
tabDetails->setMaximumSize(9999,175);
vLayout->addWidget(tabDetails);
tabDescriptionContent = new QWidget;
tabDetails->addTab(tabDescriptionContent, "Description");
QVBoxLayout* vLayout3 = new QVBoxLayout(tabDescriptionContent);
tabDescriptionContent->setLayout(vLayout3);
lblDescription = new QLabel();
lblDescription->setAlignment(Qt::AlignTop);
lblDescription->setWordWrap(true);
QScrollArea *scrollArea = new QScrollArea(this);
scrollArea->setObjectName(QString::fromUtf8("scrollArea"));
scrollArea->setFrameShape(QFrame::StyledPanel);
scrollArea->setWidgetResizable(true);
scrollArea->setWidget(lblDescription);
vLayout3->addWidget(scrollArea);
tabInfoContent = new QWidget;
tabDetails->addTab(tabInfoContent, "Information");
QGridLayout* aGridLayout = new QGridLayout();
tabInfoContent->setLayout(aGridLayout);
lblName = new QLabel("<b>Script name: </b>");
lblName->setWordWrap(true);
aGridLayout->addWidget(lblName,0,0);
lblNameValue = new QLabel();
lblNameValue->setWordWrap(true);
aGridLayout->addWidget(lblNameValue,0,1);
lblExecNb = new QLabel("<b>Executed: </b>");
lblExecNb->setWordWrap(true);
aGridLayout->addWidget(lblExecNb,1,0);
lblExecNbValue = new QLabel("0 time");
lblExecNbValue->setWordWrap(true);
aGridLayout->addWidget(lblExecNbValue,1,1);
lblCreation = new QLabel("<b>Created: </b>");
lblCreation->setWordWrap(true);
aGridLayout->addWidget(lblCreation,0,2);
lblCreationValue = new QLabel();
lblCreationValue->setWordWrap(true);
aGridLayout->addWidget(lblCreationValue,0,3);
lblNbEdition = new QLabel("<b>Edited: </b>");
lblNbEdition->setWordWrap(true);
aGridLayout->addWidget(lblNbEdition,1,2);
lblNbEditionValue = new QLabel("0 time");
lblNbEditionValue->setWordWrap(true);
aGridLayout->addWidget(lblNbEditionValue,1,3);
lblLastEditDate = new QLabel("<b>Last edition: </b>");
lblLastEditDate->setWordWrap(true);
aGridLayout->addWidget(lblLastEditDate,2,0);
lblLastEditDateValue = new QLabel();
lblLastEditDateValue->setWordWrap(true);
aGridLayout->addWidget(lblLastEditDateValue,2,1);
lblMoyExecTime = new QLabel("<b>Moy. exec time:");
lblMoyExecTime->setWordWrap(true);
aGridLayout->addWidget(lblMoyExecTime,2,2);
lblMoyExecTimeValue = new QLabel();
lblMoyExecTimeValue->setWordWrap(true);
//.........这里部分代码省略.........
示例8: numTableIm
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
//ui->setupUi(this);
setFixedHeight(768); //1024
setFixedWidth(768);
//Define page structure
QWidget * page = new QWidget(this);
page->setFixedWidth(this->width());
page->setFixedHeight(this->height());
page->setStyleSheet("background-color:white;");
QVBoxLayout * pageLayout = new QVBoxLayout();
//Define the fixed header
QWidget * header = new QWidget(page);
header->setFixedWidth(page->width());
QGridLayout * headerLayout = new QGridLayout();
headerLayout->setHorizontalSpacing(2);
headerLayout->setVerticalSpacing(2);
QLabel * numTable = new QLabel();
QPixmap numTableIm(":/Images/images/NumTable.png");
// numTable->setStyleSheet("margin-right: 5px");
numTable->setPixmap(numTableIm);
numTable->setFixedSize(numTableIm.rect().size());
QLabel * banner = new QLabel(header);
QPixmap bannerIm(":/Images/images/Banner.png");
banner->setPixmap(bannerIm);
banner->setFixedSize(bannerIm.rect().size());
QPushButton * pain = new QPushButton("");
QPixmap painIm(":/Images/images/Pain.png");
QIcon painIcon(painIm);
pain->setIcon(painIcon);
pain->setIconSize(painIm.rect().size());
pain->setFixedSize(painIm.rect().size());
QPushButton * eau = new QPushButton("");
QPixmap eauIm(":/Images/images/eau.png");
QIcon eauIcon(eauIm);
eau->setIcon(eauIcon);
eau->setIconSize(eauIm.rect().size());
eau->setFixedSize(eauIm.rect().size());
QPushButton * serveur = new QPushButton("");
QPixmap serveurIm(":/Images/images/Serveur.png");
QIcon serveurIcon(serveurIm);
serveur->setIcon(serveurIcon);
serveur->setIconSize(serveurIm.rect().size());
serveur->setFixedSize(serveurIm.rect().size());
headerLayout->addWidget(numTable, 0, 0, 2, 0);
headerLayout->addWidget(banner, 0, 1, 2, 1);
headerLayout->addWidget(serveur,0, 2, 2, 2);
headerLayout->addWidget(pain, 0, 3);
headerLayout->addWidget(eau, 1, 3);
header->setLayout(headerLayout);
//Define the widget containing all the meals (Tabs)
QTabWidget * repasFrame = new QTabWidget(page);
//For one Meal, define the widget containing all the bands
QWidget * area = new QWidget(repasFrame);
QScrollArea * sArea = new QScrollArea(area);
QPalette * palette = new QPalette();
palette->setColor(QPalette::Background, Qt::white);
sArea->setPalette(*palette);
sArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
sArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
sArea->setFixedWidth(page->width() -20);
sArea->setFixedHeight(page->height() - header->height() - 125);
bands = new QWidget();
bands->setFixedWidth(page->width() -25);
// bands->setMinimumHeight(page->height() - header->height() - 125);
bands->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Ignored);
bandsLayout = new QVBoxLayout(bands);
Headband* menus = HeadbandFactory::buildMenus(bands);
bandList.append(menus);
bandsLayout->addWidget(menus);
usefulLabel = new QLabel();
bandsLayout->addWidget(usefulLabel);
bands->setLayout(bandsLayout);
sArea->setWidget(bands);
repasFrame->setFixedWidth(page->width());
repasFrame->setFixedHeight(page->height() - header->height());
repasFrame->addTab(area, "Repas 1");
repasFrame->addTab(new QLabel(), "+");
//Define the confirmation button
//.........这里部分代码省略.........
示例9: QMainWindow
BlitzMainWindow::BlitzMainWindow()
: QMainWindow()
{
setWindowTitle(tr("Blitz Effect Test"));
QScrollArea *sa = new QScrollArea(this);
lbl = new QLabel;
sa->setWidget(lbl);
setCentralWidget(sa);
QToolBar *tBar = addToolBar(tr("Effect Options"));
QAction *openAct = tBar->addAction(tr("Open"), this, SLOT(slotOpen()));
QAction *revertAct = tBar->addAction(tr("Revert"), this, SLOT(slotRevert()));
qualityCB = new QCheckBox(tr("High Quality"), tBar);
qualityCB->setChecked(true);
tBar->addWidget(qualityCB);
QMenuBar *mBar = menuBar();
QMenu *fileMnu = mBar->addMenu(tr("File"));
fileMnu->addAction(openAct);
fileMnu->addAction(revertAct);
fileMnu->addSeparator();
fileMnu->addAction(tr("Close"), this, SLOT(close()));
QMenu *effectMnu = mBar->addMenu(tr("Effects"));
effectMnu->addAction(tr("Grayscale (MMX)"), this, SLOT(slotGrayscale()));
effectMnu->addAction(tr("Invert (MMX)"), this, SLOT(slotInvert()));
QMenu *subMnu = effectMnu->addMenu(tr("Threshold"));
subMnu->addAction(tr("Threshold (Default)"), this, SLOT(slotThreshold()));
subMnu->addAction(tr("Threshold (Red)"), this, SLOT(slotThresholdRed()));
subMnu->addAction(tr("Threshold (Green)"), this, SLOT(slotThresholdGreen()));
subMnu->addAction(tr("Threshold (Blue)"), this, SLOT(slotThresholdBlue()));
subMnu->addAction(tr("Threshold (Alpha)"), this, SLOT(slotThresholdAlpha()));
subMnu = effectMnu->addMenu(tr("Intensity (MMX)"));
subMnu->addAction(tr("Increment Intensity"), this, SLOT(slotIncIntensity()));
subMnu->addAction(tr("Decrement Intensity"), this, SLOT(slotDecIntensity()));
subMnu->addSeparator();
subMnu->addAction(tr("Increment Red Intensity"), this, SLOT(slotIncRedIntensity()));
subMnu->addAction(tr("Decrement Red Intensity"), this, SLOT(slotDecRedIntensity()));
subMnu->addAction(tr("Increment Green Intensity"), this, SLOT(slotIncGreenIntensity()));
subMnu->addAction(tr("Decrement Green Intensity"), this, SLOT(slotDecGreenIntensity()));
subMnu->addAction(tr("Increment Blue Intensity"), this, SLOT(slotIncBlueIntensity()));
subMnu->addAction(tr("Decrement Blue Intensity"), this, SLOT(slotDecBlueIntensity()));
effectMnu->addSeparator();
effectMnu->addAction(tr("Spiff"), this, SLOT(slotSpiff()));
effectMnu->addAction(tr("Dull"), this, SLOT(slotDull()));
effectMnu->addSeparator();
effectMnu->addAction(tr("Desaturate"), this, SLOT(slotDesaturate()));
effectMnu->addAction(tr("Fade"), this, SLOT(slotFade()));
effectMnu->addAction(tr("Flatten"), this, SLOT(slotFlatten()));
effectMnu->addSeparator();
effectMnu->addAction(tr("Sharpen"), this, SLOT(slotSharpen()));
effectMnu->addAction(tr("Blur"), this, SLOT(slotBlur()));
effectMnu->addAction(tr("Gaussian Sharpen (MMX)"), this, SLOT(slotGaussianSharpen()));
effectMnu->addAction(tr("Gaussian Blur (MMX)"), this, SLOT(slotGaussianBlur()));
effectMnu->addSeparator();
effectMnu->addAction(tr("Sobel Edge (MMX)"), this, SLOT(slotEdge()));
effectMnu->addAction(tr("Convolve Edge (MMX)"), this, SLOT(slotConvolveEdge()));
effectMnu->addSeparator();
effectMnu->addAction(tr("Equalize"), this, SLOT(slotEqualize()));
effectMnu->addAction(tr("Normalize"), this, SLOT(slotNormalize()));
effectMnu->addAction(tr("Despeckle"), this, SLOT(slotDespeckle()));
effectMnu->addSeparator();
effectMnu->addAction(tr("Charcoal"), this, SLOT(slotCharcoal()));
effectMnu->addAction(tr("Swirl"), this, SLOT(slotSwirl()));
effectMnu->addAction(tr("Implode"), this, SLOT(slotImplode()));
effectMnu->addAction(tr("Wave"), this, SLOT(slotWave()));
effectMnu->addAction(tr("Oil Paint"), this, SLOT(slotOilpaint()));
effectMnu->addAction(tr("Emboss"), this, SLOT(slotEmboss()));
effectMnu->addSeparator();
effectMnu->addAction(tr("Smoothscale Filtered..."), this, SLOT(slotSmoothscaleFiltered()));
effectMnu->addSeparator();
effectMnu->addAction(tr("Modulate..."), this, SLOT(slotModulate()));
effectMnu->addSeparator();
effectMnu->addAction(tr("Gradient..."), this, SLOT(slotGradient()));
effectMnu->addAction(tr("Unbalanced Gradient..."), this, SLOT(slotUnbalancedGradient()));
effectMnu->addAction(tr("8bpp Gradient..."), this, SLOT(slotGrayscaleGradient()));
effectMnu->addAction(tr("8bpp Unbalanced Gradient..."), this, SLOT(slotGrayscaleUnbalancedGradient()));
resize(sizeHint());
}
示例10: QShortcut
ContentDialog::ContentDialog(SettingsWidget* settingsWidget, QWidget* parent)
: ActivateDialog(parent, Qt::Window)
, activeChatroomWidget(nullptr)
, settingsWidget(settingsWidget)
{
QVBoxLayout* boxLayout = new QVBoxLayout(this);
boxLayout->setMargin(0);
boxLayout->setSpacing(0);
splitter = new QSplitter(this);
setStyleSheet("QSplitter{color: rgb(255, 255, 255);background-color: rgb(255, 255, 255);alternate-background-color: rgb(255, 255, 255);border-color: rgb(255, 255, 255);gridline-color: rgb(255, 255, 255);selection-color: rgb(255, 255, 255);selection-background-color: rgb(255, 255, 255);}QSplitter:handle{color: rgb(255, 255, 255);background-color: rgb(255, 255, 255);}");
splitter->setHandleWidth(6);
QWidget *friendWidget = new QWidget();
friendWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
friendWidget->setAutoFillBackground(true);
friendLayout = new FriendListLayout();
friendLayout->setMargin(0);
friendLayout->setSpacing(0);
friendWidget->setLayout(friendLayout);
onGroupchatPositionChanged(Settings::getInstance().getGroupchatPosition());
QScrollArea *friendScroll = new QScrollArea(this);
friendScroll->setMinimumWidth(220);
friendScroll->setFrameStyle(QFrame::NoFrame);
friendScroll->setLayoutDirection(Qt::RightToLeft);
friendScroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
friendScroll->setStyleSheet(Style::getStylesheet(":/ui/friendList/friendList.css"));
friendScroll->setWidgetResizable(true);
friendScroll->setWidget(friendWidget);
QWidget* contentWidget = new QWidget(this);
contentWidget->setAutoFillBackground(true);
contentLayout = new ContentLayout(contentWidget);
contentLayout->setMargin(0);
contentLayout->setSpacing(0);
splitter->addWidget(friendScroll);
splitter->addWidget(contentWidget);
splitter->setStretchFactor(1, 1);
splitter->setCollapsible(1, false);
boxLayout->addWidget(splitter);
connect(splitter, &QSplitter::splitterMoved, this, &ContentDialog::saveSplitterState);
connect(settingsWidget, &SettingsWidget::groupchatPositionToggled, this, &ContentDialog::onGroupchatPositionChanged);
setMinimumSize(500, 220);
setAttribute(Qt::WA_DeleteOnClose);
QByteArray geometry = Settings::getInstance().getDialogGeometry();
if (!geometry.isNull())
restoreGeometry(geometry);
else
resize(720, 400);
QByteArray splitterState = Settings::getInstance().getDialogSplitterState();
if (!splitterState.isNull())
splitter->restoreState(splitterState);
currentDialog = this;
setAcceptDrops(true);
new QShortcut(Qt::CTRL + Qt::Key_Q, this, SLOT(close()));
new QShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_Tab, this, SLOT(previousContact()));
new QShortcut(Qt::CTRL + Qt::Key_Tab, this, SLOT(nextContact()));
new QShortcut(Qt::CTRL + Qt::Key_PageUp, this, SLOT(previousContact()));
new QShortcut(Qt::CTRL + Qt::Key_PageDown, this, SLOT(nextContact()));
connect(Core::getInstance(), &Core::usernameSet, this, &ContentDialog::updateTitleUsername);
Translator::registerHandler(std::bind(&ContentDialog::retranslateUi, this), this);
}
示例11: 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;
}
示例12: 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");
//.........这里部分代码省略.........
示例13: RankingWidget
AppStoreRankingWidget::AppStoreRankingWidget(QWidget *parent)
{
QString paths[] =
{
Webbox::Utility::PathUtil::GetCurrentExePath() +"/Skin/img/dota2.png",
Webbox::Utility::PathUtil::GetCurrentExePath() +"/Skin/img/messages.png",
Webbox::Utility::PathUtil::GetCurrentExePath() +"/Skin/img/safari.png",
Webbox::Utility::PathUtil::GetCurrentExePath() +"/Skin/img/ibooks.png",
Webbox::Utility::PathUtil::GetCurrentExePath() +"/Skin/img/launchpad.png",
Webbox::Utility::PathUtil::GetCurrentExePath() +"/Skin/img/maps.png",
Webbox::Utility::PathUtil::GetCurrentExePath() +"/Skin/img/facetime.png",
Webbox::Utility::PathUtil::GetCurrentExePath() +"/Skin/img/gamecenter.png"
};
QColor colors[] =
{
QColor(255, 0, 0),
QColor(0, 255, 0),
QColor(0, 0, 255),
QColor(100, 100, 100),
QColor(255, 0, 255),
QColor(0, 255, 255),
QColor(0, 100, 230),
QColor(255, 100, 0, 100),
};
contentWidget = new RankingWidget();
for (int i = 0; i < 8; ++i)
{
RankingLabel *label = new RankingLabel(700, 100, 102, paths[i], QString::fromWCharArray(L"Office 2015"), QString::fromWCharArray(L"Windows 7+"), QString::fromWCharArray(L"Æƽâ"));
label->setColor(colors[7]);
contentWidget->addItem(label);
}
QScrollArea *scrollArea = new QScrollArea;
scrollArea->setGeometry(contentWidget->geometry());
scrollArea->setWidget(contentWidget); // MainWidget is the container widget i.e. the window itself
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
/*scrollArea->viewport()->setAutoFillBackground(true);
scrollArea->setStyleSheet("background-color:transparent;");*/
scrollArea->verticalScrollBar()->setStyleSheet("QScrollBar{background:transparent; width: 10px;}"
"QScrollBar::handle{background:lightgray; border:2px solid transparent; border-radius:5px;}"
"QScrollBar::handle:hover{background:gray;}"
"QScrollBar::sub-line{background:transparent;}"
"QScrollBar::add-line{background:transparent;}");
NavControlWidget *navWidget = new NavControlWidget();
QHBoxLayout *bot_layout = new QHBoxLayout();
bot_layout->addStretch();
bot_layout->addWidget(navWidget);
bot_layout->addStretch();
QVBoxLayout *mainLayout = new QVBoxLayout();
mainLayout->addWidget(scrollArea);
mainLayout->addLayout(bot_layout);
setLayout(mainLayout);
}
示例14: nameRegex
EditRubyMeasureView::EditRubyMeasureView()
: QWidget()
{
QVBoxLayout * layout = new QVBoxLayout();
layout->setContentsMargins(0,0,0,0);
setLayout(layout);
QScrollArea * scrollArea = new QScrollArea();
layout->addWidget(scrollArea);
scrollArea->setWidgetResizable(true);
QWidget * scrollWidget = new QWidget();
scrollWidget->setSizePolicy(QSizePolicy::Ignored,QSizePolicy::Preferred);
scrollArea->setWidget(scrollWidget);
m_mainVLayout = new QVBoxLayout();
m_mainVLayout->setContentsMargins(5,5,5,5);
m_mainVLayout->setSpacing(5);
m_mainVLayout->setAlignment(Qt::AlignTop);
scrollWidget->setLayout(m_mainVLayout);
QLabel * measureOptionTitleLabel = new QLabel("Name");
measureOptionTitleLabel->setObjectName("H2");
m_mainVLayout->addWidget(measureOptionTitleLabel);
QRegExp nameRegex("^\\S.*");
QRegExpValidator* validator = new QRegExpValidator(nameRegex, this);
nameLineEdit = new QLineEdit();
nameLineEdit->setValidator(validator);
m_mainVLayout->addWidget(nameLineEdit);
QLabel * descriptionTitleLabel = new QLabel("Description");
descriptionTitleLabel->setObjectName("H2");
m_mainVLayout->addWidget(descriptionTitleLabel);
descriptionTextEdit = new QTextEdit();
descriptionTextEdit->setFixedHeight(70);
descriptionTextEdit->setAcceptRichText(false);
descriptionTextEdit->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
descriptionTextEdit->setTabChangesFocus(true);
m_mainVLayout->addWidget(descriptionTextEdit);
QLabel * modelerDescriptionTitleLabel = new QLabel("Modeler Description");
modelerDescriptionTitleLabel->setObjectName("H2");
m_mainVLayout->addWidget(modelerDescriptionTitleLabel);
modelerDescriptionLabel = new QLabel();
modelerDescriptionLabel->setWordWrap(true);
m_mainVLayout->addWidget(modelerDescriptionLabel);
QFrame * line2 = new QFrame();
line2->setFrameShape(QFrame::HLine);
line2->setFrameShadow(QFrame::Sunken);
m_mainVLayout->addWidget(line2);
QLabel * inputsTitleLabel = new QLabel("Inputs");
inputsTitleLabel->setObjectName("H2");
m_mainVLayout->addWidget(inputsTitleLabel);
m_inputsVLayout = new QVBoxLayout();
m_inputsVLayout->setContentsMargins(0,0,0,0);
m_inputsVLayout->setSpacing(10);
m_mainVLayout->addLayout(m_inputsVLayout);
m_mainVLayout->addStretch();
}
示例15: mousePressEvent
void QtUnit::mousePressEvent(QMouseEvent *event)
{
if (event->button() != Qt::LeftButton)
return;
if (!this->IsClickable())
return;
QVBoxLayout *objGroupLayout = new QVBoxLayout();
QScrollArea *objScroll = new QScrollArea(objDetail);
objScroll->setStyleSheet("background-color: rgb(25, 25, 25);");
objScroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
objScroll->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
QWidget *scrollChild = new QWidget();
QGridLayout *objGrid = new QGridLayout(scrollChild);
objGrid->setSizeConstraint(QLayout::SetMinAndMaxSize);
QLayout *currentLayout = NULL;
QLayoutItem *child = NULL;
if (objDetail) {
if ((currentLayout = objDetail->layout())) {
while ((child = currentLayout->takeAt(0)) != 0)
delete child->widget();
delete currentLayout;
}
}
objGroupLayout->addWidget(objScroll);
QLabel *overlapLab = new QLabel("overlap: ");
QLabel *overlapVal = new QLabel(QString::number(((Column *)node)->GetOverlap()));
objGrid->addWidget(overlapLab, 0, 0);
objGrid->addWidget(overlapVal, 0, 1);
QLabel *synapsesLab = new QLabel("synaptic details");
objGrid->addWidget(synapsesLab, 1, 0, 1, 3);
QLabel *idx = new QLabel("Idx");
QLabel *coord = new QLabel("Coord");
QLabel *firing = new QLabel("Firing");
QLabel *perm = new QLabel("Perm");
objGrid->addWidget(idx, 2, 0);
objGrid->addWidget(coord, 2, 1);
objGrid->addWidget(firing, 2, 2);
objGrid->addWidget(perm, 2, 3);
Column *col = (Column *)node;
DendriteSegment *segment = col->GetProximalDendriteSegment();
std::vector<Synapse *> syns = segment->GetSynapses();
for (int i=0; i<col->GetRecFieldSz(); i++) {
char synCoordStr[32];
memset(synCoordStr, 0, sizeof(synCoordStr));
unsigned int x = syns[i]->GetX(), y = syns[i]->GetY();
snprintf(synCoordStr, sizeof(synCoordStr), "(%d, %d)", x, y);
float p = syns[i]->GetPerm();
QLabel *synIdx = new QLabel(QString("%1: ").arg(i));
QLabel *synCoordLab = new QLabel(synCoordStr);
QLabel *synFiring = new QLabel(QString("%1").arg(syns[i]->IsFiring()? 1 : 0));
QLabel *synPerm = new QLabel(QString("%1: ").arg(p));
objGrid->addWidget(synIdx, 3+i, 0, 1, 1);
objGrid->addWidget(synCoordLab, 3+i, 1, 1, 1);
objGrid->addWidget(synFiring, 3+i, 2, 1, 1);
objGrid->addWidget(synPerm, 3+i, 3, 1, 1);
}
// Note: must add the layout of widget before calling setWidget() or won't
// be visible.
objScroll->setWidget(scrollChild);
objDetail->setLayout(objGroupLayout);
}