本文整理汇总了C++中QScrollArea::setFixedSize方法的典型用法代码示例。如果您正苦于以下问题:C++ QScrollArea::setFixedSize方法的具体用法?C++ QScrollArea::setFixedSize怎么用?C++ QScrollArea::setFixedSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QScrollArea
的用法示例。
在下文中一共展示了QScrollArea::setFixedSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QAction
//.........这里部分代码省略.........
relMenu = operationMenu->addMenu(tr("&Relational"));
segmentationMenu = menuBar()->addMenu(tr("&Segmentation"));
equalizationMenu->setEnabled(false);
thresholdMenu->setEnabled(false);
contrastMenu->setEnabled(false);
noiseMenu->setEnabled(false);
edgeMenu->setEnabled(false);
operationMenu->setEnabled(false);
segmentationMenu->setEnabled(false);
fileMenu->addAction(openAction);
fileMenu->addAction(saveAction);
fileMenu->addSeparator();
fileMenu->addAction(exitAction);
equalizationMenu->addAction(equalAction);
thresholdMenu->addAction(otsuAction);
thresholdMenu->addAction(isodataAction);
thresholdMenu->addAction(manualAction);
contrastMenu->addAction(gammaAction);
contrastMenu->addAction(stretchingAction);
noiseMenu->addAction(sigmaAction);
noiseMenu->addAction(medianAction);
noiseMenu->addAction(lineAction);
noiseMenu->addAction(pixelAction);
noiseMenu->addAction(gaussianAction);
edgeMenu->addAction(sobelAction);
edgeMenu->addAction(horizontalAction);
edgeMenu->addAction(cannyAction);
boolMenu->addAction(andAction);
boolMenu->addAction(orAction);
boolMenu->addAction(xorAction);
boolMenu->addAction(notAction);
arithMenu->addAction(sumAction);
arithMenu->addAction(resAction);
arithMenu->addAction(multAction);
arithMenu->addAction(divAction);
arithMenu->addAction(avgAction);
relMenu->addAction(minAction);
relMenu->addAction(maxAction);
segmentationMenu->addAction(kmeansAction);
//-----
viewer = new ImageViewer(this);
QScrollArea * scrollArea = new QScrollArea;
scrollArea->setWidget(viewer);
scrollArea->setFixedWidth(600);
scrollArea->setWidgetResizable(true);
boxW = new QSpinBox();
boxW->setEnabled(false);
boxW->setMaximum(65535);
boxC = new QSpinBox();
boxC->setEnabled(false);
boxC->setMaximum(65535);
histoViewer = new ImageViewer(this);
QScrollArea * histoArea = new QScrollArea;
histoArea->setWidget(histoViewer);
histoArea->setFixedSize(268,278);
histoArea->setWidgetResizable(false);
QVBoxLayout * rightLayout = new QVBoxLayout;
rightLayout->addWidget(new QLabel("Window:",this));
rightLayout->addWidget(boxW);
rightLayout->addWidget(new QLabel("Level:",this));
rightLayout->addWidget(boxC);
rightLayout->addWidget(histoArea);
connect(boxW,SIGNAL(valueChanged(int)),this,SLOT(changeW(int)));
connect(boxC,SIGNAL(valueChanged(int)),this,SLOT(changeC(int)));
QWidget * rightSide = new QWidget;
rightSide->setLayout(rightLayout);
QHBoxLayout *mainLayout = new QHBoxLayout;
mainLayout->addWidget(scrollArea);
mainLayout->addWidget(rightSide);
QWidget * centralWidget = new QWidget();
centralWidget->setLayout(mainLayout);
setCentralWidget(centralWidget);
setWindowTitle(tr("DICOM Image Processor"));
setFixedSize(QSize(900,600));
}
示例2: 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()));
//.........这里部分代码省略.........