本文整理汇总了C++中setViewportMargins函数的典型用法代码示例。如果您正苦于以下问题:C++ setViewportMargins函数的具体用法?C++ setViewportMargins怎么用?C++ setViewportMargins使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setViewportMargins函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setViewportMargins
void TraceWidget::updateMargins(int width)
{
if (isLeftToRight())
setViewportMargins(width + cbar_->width(), 0, 0, 0);
else
setViewportMargins(0, 0, width + cbar_->width(), 0);
}
示例2: setViewportMargins
void QScriptEdit::updateExtraAreaWidth()
{
if (isLeftToRight())
setViewportMargins(extraAreaWidth(), 0, 0, 0);
else
setViewportMargins(0, 0, extraAreaWidth(), 0);
}
示例3: setViewportMargins
void TextEdit::updateLineNumberAreaWidth(int /* newBlockCount */)
{
if (lineNumberArea->isVisiblePrivate())
setViewportMargins(lineNumberAreaWidth() + 12, 0, 0, 0);
else
setViewportMargins(0, 0, 0, 0);
}
示例4: setViewportMargins
void TextEditLineNumbers::setLineAreaVisble(bool visible)
{
m_lineAreaVisble = visible;
if (m_lineAreaVisble) {
setViewportMargins(getAreaWidth(),0,0,0);
}
else {
setViewportMargins(0,0,0,0);
}
}
示例5: setViewportMargins
void FilterTableHeader::updateGeometries()
{
// If there are any input widgets add a viewport margin to the header to generate some empty space for them which is not affected by scrolling
if(filterWidgets.size())
setViewportMargins(0, 0, 0, filterWidgets.at(0)->sizeHint().height());
else
setViewportMargins(0, 0, 0, 0);
// Now just call the parent implementation and reposition the input widgets
QHeaderView::updateGeometries();
adjustPositions();
}
示例6: setHorizontalScrollBarPolicy
void SourceViewerWidget::optionChanged(const QString &option, const QVariant &value)
{
if (option == QLatin1String("Interface/ShowScrollBars"))
{
setHorizontalScrollBarPolicy(value.toBool() ? Qt::ScrollBarAsNeeded : Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(value.toBool() ? Qt::ScrollBarAsNeeded : Qt::ScrollBarAlwaysOff);
}
else if (option == QLatin1String("SourceViewer/ShowLineNumbers"))
{
if (value.toBool() && !m_marginWidget)
{
m_marginWidget = new MarginWidget(this);
m_marginWidget->show();
m_marginWidget->setGeometry(QRect(contentsRect().left(), contentsRect().top(), m_marginWidget->width(), contentsRect().height()));
}
else if (!value.toBool() && m_marginWidget)
{
m_marginWidget->deleteLater();
m_marginWidget = NULL;
setViewportMargins(0, 0, 0, 0);
}
}
else if (option == QLatin1String("SourceViewer/WrapLines"))
{
setLineWrapMode(value.toBool() ? QPlainTextEdit::WidgetWidth : QPlainTextEdit::NoWrap);
}
}
示例7: QPlainTextEdit
SourceWindow::SourceWindow(const QString& fileName, QWidget* parent) :
QPlainTextEdit(parent),
m_fileName(fileName),
m_highlighter(0),
m_widthItems(16),
m_widthPlus(12),
m_widthLineNo(30),
m_lineInfoArea(new LineInfoArea(this))
{
// load pixmaps
m_pcinner = UserIcon("pcinner");
m_pcup = UserIcon("pcup");
m_brkena = UserIcon("brkena");
m_brkdis = UserIcon("brkdis");
m_brktmp = UserIcon("brktmp");
m_brkcond = UserIcon("brkcond");
m_brkorph = UserIcon("brkorph");
setFont(KGlobalSettings::fixedFont());
setReadOnly(true);
setViewportMargins(lineInfoAreaWidth(), 0, 0 ,0);
setWordWrapMode(QTextOption::NoWrap);
connect(this, SIGNAL(updateRequest(const QRect&, int)),
m_lineInfoArea, SLOT(update()));
connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(cursorChanged()));
// add a syntax highlighter
if (QRegExp("\\.(c(pp|c|\\+\\+)?|CC?|h(\\+\\+|h|pp)?|HH?)$").indexIn(m_fileName) >= 0)
{
m_highlighter = new HighlightCpp(this);
}
}
示例8: setViewportMargins
void MarkdownEditor::setupPaperMargins(int width)
{
if (EditorWidthFull == editorWidth)
{
preferredLayout->setContentsMargins(0, 0, 0, 0);
setViewportMargins(0, 0, 0, 0);
return;
}
int screenWidth = QApplication::desktop()->screenGeometry().width();
int proposedEditorWidth = width;
int margin = 0;
switch (editorWidth)
{
case EditorWidthNarrow:
proposedEditorWidth = screenWidth / 3;
break;
case EditorWidthMedium:
proposedEditorWidth = screenWidth / 2;
break;
case EditorWidthWide:
proposedEditorWidth = 2 * (screenWidth / 3);
break;
default:
break;
}
if (proposedEditorWidth <= width)
{
margin = (width - proposedEditorWidth) / 2;
}
if (EditorAspectStretch == aspect)
{
preferredLayout->setContentsMargins(0, 0, 0, 0);
setViewportMargins(margin, 20, margin, 0);
}
else
{
preferredLayout->setContentsMargins(margin, 20, margin, 20);
setViewportMargins(10, 10, 10, 10);
}
}
示例9: setViewportMargins
void HeaderedWidget::setHeaderLabels(const QStringList& headerLabels, const char* aligns)
{
headerItemModel->setHorizontalHeaderLabels(headerLabels);
int headerHeight = headerView->sizeHint().height();
headerView->setFixedHeight(headerHeight);
setViewportMargins(0, headerHeight, 0, 0);
for(int i = headerLabels.count() - 1; i >= 0; i--)
headerItemModel->horizontalHeaderItem(i)->setTextAlignment((aligns == 0 || aligns[i] == 'l') ? Qt::AlignLeft : (aligns[i] == 'r' ? Qt::AlignRight : Qt::AlignCenter));
}
示例10: setViewportMargins
void RosegardenScrollView::setBottomFixedWidget(QWidget* w)
{
m_bottomWidget = w;
if (m_bottomWidget) {
m_bottomWidget->setParent(this);
m_bottomWidget->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed));
setViewportMargins( 0, 0, 0, m_bottomWidget->sizeHint().height() );
RG_DEBUG << "RosegardenScrollView::setBottomFixedWidget" << endl;
}
}
示例11: QTextEdit
XMLTextEdit::XMLTextEdit(QWidget *parent)
: QTextEdit(parent)
{
setViewportMargins(50, 0, 0, 0);
highlight = new XmlHighlighter(document());
setLineWrapMode ( QTextEdit::NoWrap );
setAcceptRichText ( false );
connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(update()));
connect(this, SIGNAL(textChanged()), this, SLOT(update()));
}
示例12: setViewportMargins
/*******************************************************************************
show/hide bottom panel
*******************************************************************************/
void BrowserView::show_bottom_panel(QWidget* w)
{
//Debug::debug() << " [BrowserView] show_bottom_panel";
m_bottomWidget->setContent( w );
if(!w)
{
m_bottomWidget->hide();
setViewportMargins(0,0,0,0);
}
else
{
m_bottomWidget->show();
m_bottomWidget->resize(m_bottomWidget->width(),w->sizeHint().height() + 4);
setViewportMargins(0,0,0,w->sizeHint().height() + 4);
}
}
示例13: QScrollArea
EvScrollTabBar::EvScrollTabBar(Qt::Orientation orientation,QWidget *parent) :
QScrollArea(parent)
{
m_tabBar = new EvTabBar(orientation,this);
setWidget(m_tabBar);
setWidgetResizable(true);
setViewportMargins(0,0,-3,-3);
setFrameShape(QFrame::NoFrame);
connect(m_tabBar,SIGNAL(currentIndexChanged(bool)),this,SLOT(updateScrollPosition(bool)));
}
示例14: QPlainTextEdit
/* ==== JBEAM TEXT EDIT ==== */
JBEAM_TextBox::JBEAM_TextBox(QWidget *parent, NodeBeam *nb) : QPlainTextEdit(parent)
{
LineNumbersA = new LineNumbers(this);
setViewportMargins(26,0,0,0);
//Connect linenumbers update request
connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumbers(QRect,int)));
connect(this, SIGNAL(textChanged()), this, SLOT(textchanged()));
synhigh = new Highlighter(this->document());
JBEAM_NodeCursor = -1;
JBEAM_BeamCursor = -1;
CurrentNodeBeam = nb;
this->setLineWrapMode(QPlainTextEdit::NoWrap); //No automatic line change
this->setTabStopWidth(15); //Set smaller TAB width
EmptyJbeamTextTemplate = "{\n"
" \"Vehicle\":{\n"
" \"information\":{\n"
" \"authors\":\"Your name\" \n"
" },\n"
" \"nodes\":[\n"
" [\"id\", \"posX\", \"posY\", \"posZ\"],\n\n"
" //BNEnodes\n"
" \n"
" ],\n"
" \"beams\":[\n"
" [\"id1:\", \"id2:\"],\n\n"
" //BNEbeams\n"
" \n"
" \n"
" ],\n"
" \"triangles\":[\n"
" [\"id1:\", \"id2:\", \"id3:\"],\n\n"
" //BNEtriangles\n"
" \n"
" \n"
" ],\n"
" }\n"
"}\n";
ResetContents();
QFont fontti;
fontti.setFamily(tr("Verdana"));
this->setFont(fontti);
for(int i=0; i<CurrentNodeBeam->ListTypes.size();i++)
{
this->JBEAM_curorNames.append(CurrentNodeBeam->ListTypes.at(i).keyword);
}
}
示例15: verticalScrollBar
void AdjustingScrollArea::resizeEvent(QResizeEvent* ev)
{
int scrollBarWidth =
verticalScrollBar()->isVisible() ? verticalScrollBar()->sizeHint().width() : 0;
if (layoutDirection() == Qt::RightToLeft)
setViewportMargins(-scrollBarWidth, 0, 0, 0);
updateGeometry();
QScrollArea::resizeEvent(ev);
}