本文整理汇总了C++中QLabel::setFrameShape方法的典型用法代码示例。如果您正苦于以下问题:C++ QLabel::setFrameShape方法的具体用法?C++ QLabel::setFrameShape怎么用?C++ QLabel::setFrameShape使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLabel
的用法示例。
在下文中一共展示了QLabel::setFrameShape方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawitems
void boxAvail::drawitems ()
{
int x=190, y=30;
QLabel *starter;
itemLinker *starterLinker;
starter = new QLabel(QString::number (source.first ()->getId ()),this);
starterLinker = new itemLinker(0,&Server, this);
starter->setFixedSize (30,30);
starter->setAlignment (Qt::AlignCenter);
starter->setFrameShape (QFrame::WinPanel);
starter->move (20,30);
starterLinker->draw(50,30);
for(it=source.begin (); it!=source.end (); ++it){
(*it)->draw(x,y);
(*it)->show();
x+=140;
if ( this->width()-x < 150){
x=20, y+=50;
}
}
}
示例2: f
FlashableWidget::FlashableWidget(int width, int height, QWidget *parent):
QWidget(parent) ,vLabels_(), width_(width), height_(height),
vActiveLabels_(), inactiveLabelPalette(), activeLabelPalette(),
backgroundPalette(), currentHalve(0), selectedHalveWidth(0),
selectedHalveHeight(0), firstHalveWidth(0), firstHalveHeight(0),
secondHalveWidth(0), secondHalveHeight(0)
{
grid = new QGridLayout;
QFont f("Helvetica", 20);
for(int row = 0; row < height_; ++row)
{
for(int column = 0; column < width_; ++column)
{
QLabel *label = new QLabel();
label->setFont(f);
label->setScaledContents(true);
label->setFrameShape(QFrame::Box);
label->setLineWidth(3);
label->setAlignment(Qt::AlignCenter);
label->setPalette(inactiveLabelPalette);
label->setAutoFillBackground(true);
grid->addWidget(label, row, column);
vLabels_.push_back(label);
}
}
setLayout(grid);
oneByOneIndex_ = 0;
}
示例3: QGridLayout
void Widget::build3x3frame(QFrame *box3x3frame, int rowStart, int colStart, int QMap)
{
box3x3frame->setFrameStyle(QFrame::Plain);
box3x3frame->setFrameShape(QFrame::Box);
QGridLayout* box3x3 = new QGridLayout(box3x3frame);
box3x3->setSpacing(0);
box3x3->setMargin(0);
int x = rowStart%9;
for (int i = 0; i < 3; ++i)
{
int y = colStart%9;
for (int j = 0; j < 3; ++j)
{
QLabel* cell = new QLabel("");
cell->setAlignment(Qt::AlignCenter);
//cell->setAlignment(Qt::AlignVCenter);
if(QMap) originPointToCellMap.insert(QPair<int,int>(x,y++),cell);
else resultPointToCellMap.insert(QPair<int,int>(x,y++),cell);
cell->setFrameStyle(QFrame::Plain);
cell->setFrameShape(QFrame::Box);
cell->setMargin(5);
box3x3->addWidget(cell,i,j,1,1);
}
x++;
}
}
示例4:
//! [4]
QLabel *IconPreviewArea::createPixmapLabel()
{
QLabel *label = new QLabel;
label->setEnabled(false);
label->setAlignment(Qt::AlignCenter);
label->setFrameShape(QFrame::Box);
label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
label->setBackgroundRole(QPalette::Base);
label->setAutoFillBackground(true);
label->setMinimumSize(132, 132);
return label;
}
示例5: addLabel
void ModelPanel::addLabel(QGridLayout * gridLayout, QString text, int col, bool minimize)
{
QLabel *label = new QLabel(this);
label->setFrameShape(QFrame::Panel);
label->setFrameShadow(QFrame::Raised);
label->setMidLineWidth(0);
label->setAlignment(Qt::AlignCenter);
label->setMargin(5);
label->setText(text);
if (!minimize)
label->setMinimumWidth(100);
gridLayout->addWidget(label, 0, col, 1, 1);
}
示例6: ModelPanel
TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model, FrSkyScreenData & screen, GeneralSettings & generalSettings, FirmwareInterface * firmware):
ModelPanel(parent, model, generalSettings, firmware),
ui(new Ui::TelemetryCustomScreen),
screen(screen)
{
ui->setupUi(this);
for (int l=0; l<4; l++) {
for (int c=0; c<firmware->getCapability(TelemetryCustomScreensFieldsPerLine); c++) {
fieldsCB[l][c] = new QComboBox(this);
fieldsCB[l][c]->setProperty("index", c + (l<<8));
ui->screenNumsLayout->addWidget(fieldsCB[l][c], l, c, 1, 1);
connect(fieldsCB[l][c], SIGNAL(currentIndexChanged(int)), this, SLOT(customFieldChanged(int)));
}
}
for (int l=0; l<4; l++) {
barsCB[l] = new QComboBox(this);
barsCB[l]->setProperty("index", l);
connect(barsCB[l], SIGNAL(currentIndexChanged(int)), this, SLOT(barSourceChanged(int)));
ui->screenBarsLayout->addWidget(barsCB[l], l, 0, 1, 1);
minSB[l] = new QDoubleSpinBox(this);
minSB[l]->setProperty("index", l);
connect(minSB[l], SIGNAL(valueChanged(double)), this, SLOT(barMinChanged(double)));
ui->screenBarsLayout->addWidget(minSB[l], l, 1, 1, 1);
QLabel * label = new QLabel(this);
label->setAutoFillBackground(false);
label->setStyleSheet(QString::fromUtf8("Background:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 0, 128, 255), stop:0.339795 rgba(0, 0, 128, 255), stop:0.339799 rgba(255, 255, 255, 255), stop:0.662444 rgba(255, 255, 255, 255),)\n"""));
label->setFrameShape(QFrame::Panel);
label->setFrameShadow(QFrame::Raised);
label->setAlignment(Qt::AlignCenter);
ui->screenBarsLayout->addWidget(label, l, 2, 1, 1);
maxSB[l] = new QDoubleSpinBox(this);
maxSB[l]->setProperty("index", l);
connect(maxSB[l], SIGNAL(valueChanged(double)), this, SLOT(barMaxChanged(double)));
ui->screenBarsLayout->addWidget(maxSB[l], l, 3, 1, 1);
}
disableMouseScrolling();
update();
}
示例7: setupGui
void DefinitionBoxWidget::setupGui(){
ui->labelDefinition->show();
ui->lineEditDefinition->hide();
ui->labelDefinition->setText((m_definitionMap["value"]).toString());
ui->lineEditDefinition->setText((m_definitionMap["value"]).toString());
ui->plainTextEditExampleUsage->setPlainText((m_definitionMap["usage"]).toString());
ui->plainTextEditNotes->setPlainText((m_definitionMap["notes"]).toString());
this->setToolTip( ( m_definitionMap["key"]).toString().prepend(trUtf8("Definition of ")) );
//Type tag
if((m_definitionMap["type"]).toString() != QString()){
QLabel *pTypeLabel = new QLabel((m_definitionMap["type"]).toString());
pTypeLabel->setFrameShape(QFrame::StyledPanel);
pTypeLabel->setEnabled(false);
pTypeLabel->setToolTip(trUtf8("Word Type"));
ui->horizontalLayoutTag->addWidget(pTypeLabel, 0, Qt::AlignLeft);
}
//TODO: sex tag
//TODO: antonym-synonym tag
}
示例8: createMenuItems_Selection
void ContextMenu::createMenuItems_Selection()
{
//CB TODO clean
int selectedItemCount=m_Sel.count();
if (selectedItemCount==0)
return;
bool itemsAreSameType=m_Sel.itemsAreSameType();
//Find our doc from first item in selection if we have an item
PageItem *currItem = m_Sel.itemAt(0);
assert(m_doc!=0 && currItem!=0);
QMenu *menuConvertTo = new QMenu(this);
QMenu *menuEditContent = new QMenu(this);
QMenu *menuInfo = new QMenu(this);
QMenu *menuLayer = new QMenu(this);
QMenu *menuLevel = new QMenu(this);
QMenu *menuPDF = new QMenu(this);
QMenu *menuMark = new QMenu(this);
QMenu *menuResolution = new QMenu(this);
QMenu *menuLocking = new QMenu(this);
QMenu *menuSendTo = new QMenu(this);
QMenu *menuScrapbook = new QMenu(this);
QMenu *menuEdit = new QMenu(this);
QMenu *menuImage = new QMenu(this);
// QMenu *menuWeld = new QMenu(this);
//<-- Add Info
//Test new method with image frames first
if (selectedItemCount==1 && currItem->asImageFrame())
{
QAction *act = addMenu(menuInfo);
act->setText( tr("In&fo"));
if (currItem->asImageFrame())
{
QLabel* menuLabel = new QLabel("<html>" + currItem->infoDescription() + "</html>", this);
menuLabel->setFrameShape(QFrame::NoFrame);
QWidgetAction* menuTextWidget = new QWidgetAction(this);
menuTextWidget->setDefaultWidget(menuLabel);
menuInfo->addAction(menuTextWidget);
}
}
else
{
QFrame *infoGroup = new QFrame( m_doc->view() );
infoGroup->setFrameShape( QFrame::NoFrame );
QGridLayout *infoGroupLayout = new QGridLayout( infoGroup );
infoGroupLayout->setAlignment( Qt::AlignTop );
infoGroupLayout->setSpacing( 2 );
infoGroupLayout->setMargin( 0 );
if (currItem->createInfoGroup(infoGroup, infoGroupLayout))
{
int row = infoGroupLayout->rowCount(); // <a.l.e>
QLabel *printCT = new QLabel(infoGroup);
QLabel *printT = new QLabel(infoGroup);
printCT->setText( tr("Print: "));
infoGroupLayout->addWidget( printCT, row, 0, Qt::AlignRight );
if (currItem->printEnabled())
printT->setText( tr("Enabled"));
else
printT->setText( tr("Disabled"));
infoGroupLayout->addWidget( printT, row, 1 ); // </a.l.e>
QWidgetAction* MenAct = new QWidgetAction(this);
MenAct->setDefaultWidget(infoGroup);
menuInfo->addAction(MenAct);
// Qt4 menuInfo->insertItem(infoGroup);
// currItem->createContextMenu(menuInfo, 5);
QAction *act = addMenu(menuInfo);
act->setText( tr("In&fo"));
}
else
{
delete infoGroupLayout;
delete infoGroup;
}
}
//-->
//<-- Add Contents Actions
if (m_actionList.contains("fileImportText"))
{
addSeparator();
menuEditContent->addAction(m_ScMW->scrActions["fileImportText"]);
menuEditContent->addAction(m_ScMW->scrActions["fileImportAppendText"]);
menuEditContent->addAction(m_ScMW->scrActions["toolsEditWithStoryEditor"]);
menuEditContent->addAction(m_ScMW->scrActions["insertSampleText"]);
menuEditContent->addSeparator();
}
else //enable this for, eg, text on a path
if (m_actionList.contains("toolsEditWithStoryEditor"))
{
addSeparator();
menuEditContent->addAction(m_ScMW->scrActions["toolsEditWithStoryEditor"]);
}
if (m_actionList.contains("fileImportImage"))
menuEditContent->addAction(m_ScMW->scrActions["fileImportImage"]);
if (selectedItemCount==1 && currItem->asImageFrame())
{
//.........这里部分代码省略.........
示例9: showRoomGrid
void MainWindow::showRoomGrid()
{
if(0!=Grid || 0!=scroll || 0!=layout)
{
delete Grid;
delete scroll;
delete layout;
}
layout = new QVBoxLayout();
scroll = new QScrollArea(this);
Grid = new QGridLayout(this);
Grid->setHorizontalSpacing(6);
Grid->setVerticalSpacing(6);
scroll->setLayout(Grid);
layout->addWidget(scroll);
ui->Tabs2->widget(0)->setLayout(layout);
vector<Room> Room;
QString RoomNumTitle,RoomFloor;
Room = RM.fetchAllRooms();
int RoomSize=Room.size();
int i=0,j=0;
int num=0,RoomNum=0;
while(num!=RoomSize)
{
QLabel * RoomLabel = new QLabel(this);
RoomLabel->setGeometry(0,0,310,180);
RoomLabel->setFrameShape(QFrame::Box);
RoomLabel->setFrameShadow(QFrame::Sunken);
RoomLabel->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
RoomLabel->setFont(QFont( "Comic Sans MS", 8, QFont::Bold ));
//-----------------------------------------------------------
RoomNumTitle.setNum(Room[RoomNum].getRoomNumber());
RoomFloor.setNum(Room[RoomNum].getRoomFloor());
RoomLabel->setObjectName(RoomNumTitle);
RoomLabel->setText("Num:"+RoomNumTitle+"\n Floor:"+RoomFloor);
//-----------------------------------------------------------
if(RM.getStatus(Room[RoomNum].getRoomNumber(),QDate::currentDate(),QDate::currentDate())==false)
RoomLabel->setStyleSheet("color: white; background-color:green;");
else
RoomLabel->setStyleSheet("color: white; background-color:red;");
//-----------------------------------------------------------
RoomLabel->installEventFilter(this);
Grid->addWidget(RoomLabel,i,j);
num++;
if(j<5)
{
j++;
}
else
{
j=0;
i++;
}
RoomNum++;
}
}
示例10: set
DownloadWidget::DownloadWidget(QWidget *parent)
: QWidget(parent),
m_manager(new QNetworkAccessManager(this)),
m_downloadMode(Tiles),
m_tabWidget(new QTabWidget(this)),
m_dlProgress(new QProgressBar(this)),
m_startButton(new QPushButton("&Start download", this)),
m_backButton(new QPushButton("&Back", this)),
m_startLevel(0),
m_dlRect(),
m_dlList(),
m_currentDownload(0),
m_prefix("OSM"),
m_up(new QLabel("N 0", this)),
m_left(new QLabel("E 0", this)),
m_right(new QLabel("E 0", this)),
m_bottom(new QLabel("N 0", this)),
m_levelSpinBox(new QSpinBox(this)),
m_prefixInput(new QLineEdit(this)),
m_skipExisting(new QCheckBox("S&kip already downloaded tiles", this)),
m_poiTypes(new QListWidget(this)),
m_makePOILayer(new QCheckBox("&Load file after download", this)),
m_destFilename(new QLineEdit(QDir::homePath()+"/pois.osm", this)),
m_packageList(new QListWidget(this)),
m_destDir(new QLineEdit(QDir::homePath(), this))
{
QGridLayout *layout = new QGridLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
layout->setRowStretch(0, 1);
layout->addWidget(m_tabWidget, 0, 0, 1, 2);
m_dlProgress->hide();
layout->addWidget(m_dlProgress, 1, 0, 1, 2);
m_startButton->setIcon(QIcon(":ok.png"));
connect(m_startButton, SIGNAL(clicked()), this, SLOT(startDownload()));
layout->addWidget(m_startButton, 2, 0);
m_backButton->setIcon(QIcon(":cancel.png"));
connect(m_backButton, SIGNAL(clicked()), this, SIGNAL(back()));
layout->addWidget(m_backButton, 2, 1);
QWidget *widget = new QWidget(this);
layout = new QGridLayout(widget);
layout->setContentsMargins(0, 0, 0, 0);
layout->setRowStretch(1, 1);
m_up->setAlignment(Qt::AlignHCenter);
m_left->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
m_right->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
m_bottom->setAlignment(Qt::AlignHCenter);
layout->addWidget(m_up, 0, 0, 1, 4);
layout->addWidget(m_left, 1, 0);
layout->addWidget(m_right, 1, 3);
layout->addWidget(m_bottom, 2, 0, 1, 4);
QLabel *label = new QLabel(this);
label->setFrameShape(QLabel::Box);
layout->addWidget(label, 1, 1, 1, 2);
label = new QLabel("Download up to level:", this);
layout->addWidget(label, 3, 0, 1, 2);
m_levelSpinBox->setRange(0, 18);
layout->addWidget(m_levelSpinBox, 3, 2, 1, 2);
label = new QLabel("Download into directory:", this);
layout->addWidget(label, 4, 0, 1, 2);
m_prefixInput->setText(m_prefix);
layout->addWidget(m_prefixInput, 4, 2, 1, 2);
m_skipExisting->setChecked(false);
layout->addWidget(m_skipExisting, 5, 0, 1, 0);
m_tabWidget->addTab(widget, "&Tiles");
widget = new QWidget(this);
layout = new QGridLayout(widget);
layout->setContentsMargins(0, 0, 0, 0);
layout->setRowStretch(0, 1);
QSettings set(QDir::homePath()+"/Maps/nanomap.conf", QSettings::NativeFormat);
set.beginGroup("poi");
QString iconPath = set.value("iconpath", "/usr/share/NanoMap/icons").toString();
set.endGroup();
QDir iconDir(iconPath);
QStringList icons = iconDir.entryList(QStringList() << "*.png");
foreach (const QString &icon, icons) {
QString name = icon;
name.remove(".png");
QListWidgetItem *item = new QListWidgetItem(QIcon(iconPath+"/"+icon), name);
m_poiTypes->addItem(item);
}
示例11: QWidget
WidgetImage::WidgetImage(QWidget *parent) : QWidget(parent), toolbar(0),
statusbar(0), paintWnd(0), scrollArea(0), zoomBox(0) {
toolbar = new QToolBar(tr("Image"),this);
statusbar = new QStatusBar(this);
paintWnd = new PaintWidget();
scrollArea = new QScrollArea(this);
scrollArea->setWidget(paintWnd);
scrollArea->setWidgetResizable(true);
QAction* action = new QAction(QIcon(":/icons/resources/save.png"),tr("Save Image"),toolbar);
connect(action,SIGNAL(triggered()),paintWnd,SLOT(saveImage()));
toolbar->addAction(action);
toolbar->addSeparator();
action = new QAction(QIcon(":/icons/resources/arrow_in.png"),tr("Fit to Window"),toolbar);
action->setCheckable(true);
action->setChecked(true);
connect(action,SIGNAL(triggered(bool)),this,SLOT(toggleFitToWindow(bool)));
connect(action,SIGNAL(triggered(bool)),paintWnd,SLOT(toggleFitToWindow(bool)));
toolbar->addAction(action);
action = new QAction(QIcon(":/icons/resources/zoom_100.png"),tr("Zoom 100%"),toolbar);
action->setEnabled(false);
connect(action,SIGNAL(triggered()),paintWnd,SLOT(zoomImage100()));
toolbar->addAction(action);
zoomBox = new QSpinBox(toolbar);
zoomBox->setToolTip(tr("Zoom Image"));
zoomBox->setRange(0,999);
zoomBox->setSingleStep(10);
zoomBox->setSuffix("%");
zoomBox->setButtonSymbols(QAbstractSpinBox::PlusMinus);
zoomBox->setEnabled(false);
connect(zoomBox,SIGNAL(valueChanged(int)),paintWnd,SLOT(zoomImage(int)));
connect(paintWnd,SIGNAL(setZoom(int)),zoomBox,SLOT(setValue(int)));
toolbar->addWidget(zoomBox);
QLabel* typeLabel = new QLabel(statusbar);
typeLabel->setTextFormat(Qt::PlainText);
typeLabel->setTextInteractionFlags(Qt::NoTextInteraction);
typeLabel->setFrameShadow(QFrame::Sunken);
statusbar->addPermanentWidget(typeLabel);
QLabel* sizeLabel = new QLabel(statusbar);
sizeLabel->setTextFormat(Qt::PlainText);
sizeLabel->setTextInteractionFlags(Qt::NoTextInteraction);
sizeLabel->setFrameShadow(QFrame::Sunken);
statusbar->addPermanentWidget(sizeLabel);
QLabel* posLabel = new QLabel(statusbar);
posLabel->setTextFormat(Qt::PlainText);
posLabel->setTextInteractionFlags(Qt::NoTextInteraction);
posLabel->setFrameShape(QFrame::NoFrame);
statusbar->addWidget(posLabel,1);
connect(paintWnd,SIGNAL(setStatusMsg(QString,int)),statusbar,SLOT(showMessage(QString,int)),Qt::QueuedConnection);
connect(paintWnd,SIGNAL(printImageSize(QString)),sizeLabel,SLOT(setText(QString)),Qt::QueuedConnection);
connect(paintWnd,SIGNAL(printImageType(QString)),typeLabel,SLOT(setText(QString)),Qt::QueuedConnection);
connect(paintWnd,SIGNAL(printImagePos(QString)),posLabel,SLOT(setText(QString)),Qt::QueuedConnection);
QVBoxLayout* layout = new QVBoxLayout();
layout->addWidget(toolbar);
layout->addWidget(scrollArea,1);
layout->addWidget(statusbar);
layout->setSpacing(0);
layout->setContentsMargins(0,0,0,0);
setLayout(layout);
}
示例12: getValue
QWidget *DynamicConnectionPageWindow::createDynamicWidget(WidgetType widgetType, DynamicWidgetInfo *widgetInfo) const
{
QWidget *widget = 0;
QString value = getValue(widgetInfo->attributes.value("value"));
switch(widgetType){
case Label:
{
QLabel *label = new QLabel(value);
label->setFrameShape(QFrame::StyledPanel);
label->setFrameShadow(QFrame::Sunken);
label->setTextInteractionFlags(Qt::TextSelectableByMouse|Qt::TextSelectableByKeyboard);
widget = label;
break;
}
case CheckBox:
{
QCheckBox *checkBox = new QCheckBox();
checkBox->setChecked(value == "true");
widget = checkBox;
break;
}
case ComboBox:
{
QComboBox *comboBox = new QComboBox();
QDomNodeList childNodes = widgetInfo->childNodes;
for(int i=0; i<childNodes.size(); ++i){
QDomNode e = childNodes.at(i);
Q_ASSERT(e.nodeName() == "option");
comboBox->addItem(e.attributes().namedItem("text").toAttr().value());
}
if(!value.isEmpty()){
comboBox->setCurrentIndex(value.toInt());
}
widget = comboBox;
break;
}
case RadioButton:
{
RadioButtonGroup *radioButtonGroup = new RadioButtonGroup(widgetInfo->attributes.value("caption").isEmpty() ? Qt::Horizontal : Qt::Vertical);
QDomNodeList childNodes = widgetInfo->childNodes;
for(int i=0; i<childNodes.size(); ++i){
QDomNode e = childNodes.at(i);
Q_ASSERT(e.nodeName() == "option");
QString text = e.attributes().namedItem("text").toAttr().value();
QRadioButton *radio = new QRadioButton(text);
radioButtonGroup->addRadioButton(radio);
}
if(!value.isEmpty()){
radioButtonGroup->checkRadio(value.toInt());
}
widget = radioButtonGroup;
break;
}
default:
Q_ASSERT(false);
return 0;
break;
}
QString widgetName = widgetInfo->attributes.value("name");
widget->setObjectName(widgetName);
return widget;
}
示例13: preferencesDialog
void ActionZone::preferencesDialog() {
QSettings settings("otter", "dict");
QDialog * dialog = new QDialog();
QPushButton * okButton = new QPushButton("OK", dialog);
connect(okButton, SIGNAL(clicked()), dialog, SLOT(accept()));
QPushButton * cancelButton = new QPushButton("Cancel", dialog);
connect(cancelButton, SIGNAL(clicked()), dialog, SLOT(reject()));
QBoxLayout * buttonLayout = new QHBoxLayout();
buttonLayout->addWidget(okButton);
buttonLayout->addWidget(cancelButton);
QLabel * dictionaryCountLabel = new QLabel("Number of dictionaries", dialog);
QComboBox * dictionaryCountCombo = new QComboBox(dialog);
dictionaryCountCombo->addItem("1");
dictionaryCountCombo->addItem("2");
dictionaryCountCombo->addItem("3");
dictionaryCountCombo->addItem("4");
dictionaryCountCombo->addItem("5");
dictionaryCountCombo->setCurrentIndex(resultViewers_.size() - 1);
QLabel * pluginDirectoryLabel = new QLabel("Directory with plugins", dialog);
QLineEdit * pluginDirectory = new QLineEdit(dialog);
{
QString directories;
settings.beginGroup("application");
int size = settings.beginReadArray("plugindirectory");
for (int i = 0; i < size; i++) {
settings.setArrayIndex(i);
QString dir = settings.value("directory").toString();
if (dir.isEmpty()) {
continue;
}
directories += dir + ":";
}
pluginDirectory->setText(directories);
settings.endArray();
settings.endGroup();
}
QLabel * reloadInfoLabel = new QLabel(
"OtterDict needs to be restarted to apply the changes.", dialog);
reloadInfoLabel->setWordWrap(true);
reloadInfoLabel->setFrameShape(QFrame::StyledPanel);
QGridLayout * preferencesLayout = new QGridLayout(dialog);
preferencesLayout->setSizeConstraint(QLayout::SetFixedSize);
preferencesLayout->addWidget(dictionaryCountLabel, 0, 0, Qt::AlignRight);
preferencesLayout->addWidget(dictionaryCountCombo, 0, 1, Qt::AlignLeft);
preferencesLayout->addWidget(pluginDirectoryLabel, 1, 0, Qt::AlignRight);
preferencesLayout->addWidget(pluginDirectory, 1, 1, Qt::AlignLeft);
preferencesLayout->addWidget(reloadInfoLabel, 2, 0, 1, 2, Qt::AlignHCenter);
preferencesLayout->addLayout(buttonLayout, 3, 0, 1, 2, Qt::AlignHCenter);
dialog->setSizeGripEnabled(false);
dialog->setWindowTitle("OtterDict preferences");
QDialog::DialogCode retCode = (QDialog::DialogCode)dialog->exec();
if (retCode == QDialog::Rejected) {
return;
}
int dictionaryCount = dictionaryCountCombo->currentIndex() + 1;
settings.setValue("mainwindow/dictionarycount", dictionaryCount);
// Write the application settings.
settings.beginGroup("application");
// Write the plugin directories.
{
settings.beginWriteArray("plugindirectory");
QStringList dirs = pluginDirectory->text().split(":", QString::SkipEmptyParts);
QStringList::iterator e = dirs.end();
int idx;
QStringList::iterator i;
for (idx = 0, i = dirs.begin(); i != e; ++i, idx++) {
settings.setArrayIndex(idx);
settings.setValue("directory", *i);
}
settings.endArray();
}
settings.endGroup();
}
示例14: continueCreate
/// continue the creation of the widgets once the pieces XML was loaded.
/// this is where all the work of creating the family tabs and their content is performed.
void PicsSelectWidget::continueCreate()
{
const PicBucket& bucket = PicBucket::instance();
m_tabs = new QTabWidget(this);
connect(m_tabs, SIGNAL(currentChanged(int)), this, SLOT(updateSetsSpinBox(int)));
m_layout->addWidget(m_tabs);
m_groups.resize(bucket.grps.size());
for (int f = 0; f < bucket.families.size(); ++f)
{
const PicFamily &fam = bucket.families[f];
SizedWidget *tab = new SizedWidget(QSize(6 * BOT_TOTAL_X + BOT_OFFS_X + FRAME_OFFS_SPACE_RIGHT - 5, NUM_DEFS * BOT_TOTAL_Y + FRAME_OFFS_Y), nullptr);
//QWidget *tab = new QWidget();
//tab->resize(QSize(6 * BOT_TOTAL_X + BOT_OFFS_X + FRAME_OFFS_SPACE_RIGHT, NUM_DEFS * BOT_TOTAL_Y + FRAME_OFFS_Y));
QScrollArea *scroll = new QScrollArea();
scroll->setWidget(tab);
// the following is the voodoo needed to make the scroll area the same color as the tab
// if this wasn't here, the scroll area would have gotten the default window color
// this is significant in Windows XP with new apperance style where the tab color is
// different from the default window color
scroll->viewport()->setAutoFillBackground(false);
tab->setAutoFillBackground(false);
// scroll area has a frame by default. get rid of it.
scroll->setFrameShape(QFrame::NoFrame);
m_tabs->addTab(scroll, fam.name.c_str());
for (int g = fam.startIndex; g < fam.startIndex + fam.numGroups; ++g)
{
const PicGroupDef *grp = &(bucket.grps[g]);
GroupCtrl &grpctrl = m_groups[g];
int normg = (g - fam.startIndex); // normalized g with start of family
QGroupBox *groupbox = new QGroupBox(grp->name.c_str(), tab);
groupbox->move(BOT_OFFS_X-FRAME_OFFS_SPACE_LEFT, FRAME_OFFS_Y + normg*BOT_TOTAL_Y - 30);
groupbox->resize(FRAME_OFFS_SPACE_RIGHT + grp->numPics() * BOT_TOTAL_X, BOT_Y + 55);
grpctrl.num = new DataSpinBox(g, tab);
grpctrl.num->move(grp->numPics() * BOT_TOTAL_X + BOT_OFFS_X + FRAME_OFFS_SPACE_RIGHT - 65, BOT_OFFS_Y + normg*BOT_TOTAL_Y + 40);
grpctrl.num->resize(45, 23);
grpctrl.num->setButtonSymbols(QAbstractSpinBox::PlusMinus);
grpctrl.num->setRange(-1, MAX_IDENTICAL_PIECES);
grpctrl.num->setSpecialValueText("X");
connect(grpctrl.num, SIGNAL(dvalueChanged(int, int)), this, SLOT(changedGrpBox(int, int)));
for (int p = 0; p < bucket.grps[g].numPics(); ++p)
{
const PicDef* pic = &(grp->getPic(p));
PicCtrl picctrl;
int data = (g << 16) | p;
DataPushButton *button = new DataPushButton(data, QIcon(pic->pixmap), QString(), tab);
picctrl.bot = button;
button->setCheckable(true);
button->move(BOT_OFFS_X + p*BOT_TOTAL_X, BOT_OFFS_Y + normg * BOT_TOTAL_Y); // g normalized to start of family
button->resize(BOT_X, BOT_Y);
button->setIconSize(pic->pixmap.size()); // +1 because it's the texture + line, from Pieces.h
connect(button, SIGNAL(pclicked(int, bool)), this, SLOT(pressedPicButton(int, bool)));
DataSpinBox *spinbox = new DataSpinBox(data, tab);
picctrl.num = spinbox;
spinbox->setRange(0, MAX_IDENTICAL_PIECES);
spinbox->move(BOT_OFFS_X + p*BOT_TOTAL_X + (BOT_X/5*2 + 2), BOT_OFFS_Y + normg*BOT_TOTAL_Y + BOT_Y + 5);
spinbox->resize(BOT_X/5*3 - 4, EDIT_THICK + 1);
spinbox->setButtonSymbols(QAbstractSpinBox::PlusMinus);
connect(spinbox, SIGNAL(dvalueChanged(int, int)), this, SLOT(changedNumBox(int, int)));
QLabel *solnum = new QLabel("0", tab);
picctrl.snum = solnum;
solnum->move(BOT_OFFS_X + p*BOT_TOTAL_X + 2, BOT_OFFS_Y + normg*BOT_TOTAL_Y + BOT_Y + 6);
solnum->resize(BOT_X/5*2 - 4, EDIT_THICK);
solnum->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
solnum->setFrameShadow(QFrame::Sunken);
solnum->setFrameShape(QFrame::Panel);
solnum->setPalette(*m_slvPalette);
solnum->setVisible(false);
grpctrl.pics.push_back(picctrl);
}
}
}
setBuildTilesCount(m_doc->getBuild().tilesCount());
// prevent the build Help sidebar to get notifications. it might not be there yet.
// eventually the sidebar will take care of itself.
blockSignals(true);
changeToResetValues();
//.........这里部分代码省略.........