本文整理汇总了C++中QSplitter::handleWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ QSplitter::handleWidth方法的具体用法?C++ QSplitter::handleWidth怎么用?C++ QSplitter::handleWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSplitter
的用法示例。
在下文中一共展示了QSplitter::handleWidth方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: splitViewSpace
void KateViewManager::splitViewSpace( KateViewSpace* vs, // = 0
Qt::Orientation o )// = Qt::Horizontal
{
// emergency: fallback to activeViewSpace, and if still invalid, abort
if (!vs) vs = activeViewSpace();
if (!vs) return;
// get current splitter, and abort if null
QSplitter *currentSplitter = qobject_cast<QSplitter*>(vs->parentWidget());
if (!currentSplitter) return;
// index where to insert new splitter/viewspace
const int index = currentSplitter->indexOf( vs );
// create new viewspace
KateViewSpace* vsNew = new KateViewSpace( this );
// only 1 children -> we are the root container. So simply set the orientation
// and add the new view space, then correct the sizes to 50%:50%
if (currentSplitter->count() == 1)
{
if( currentSplitter->orientation() != o )
currentSplitter->setOrientation( o );
QList<int> sizes = currentSplitter->sizes();
sizes << (sizes.first() - currentSplitter->handleWidth() ) / 2;
sizes[0] = sizes[1];
currentSplitter->insertWidget( index, vsNew );
currentSplitter->setSizes( sizes );
}
else
{
// create a new QSplitter and replace vs with the splitter. vs and newVS are
// the new children of the new QSplitter
QSplitter* newContainer = new QSplitter( o );
newContainer->setOpaqueResize( KGlobalSettings::opaqueResize() );
QList<int> currentSizes = currentSplitter->sizes();
newContainer->addWidget( vs );
newContainer->addWidget( vsNew );
currentSplitter->insertWidget( index, newContainer );
newContainer->show();
// fix sizes of children of old and new splitter
currentSplitter->setSizes( currentSizes );
QList<int> newSizes = newContainer->sizes();
newSizes[0] = (newSizes[0] + newSizes[1] - newContainer->handleWidth()) / 2;
newSizes[1] = newSizes[0];
newContainer->setSizes( newSizes );
}
m_viewSpaceList.append( vsNew );
activeViewSpace()->setActive( false );
vsNew->setActive( true, true );
vsNew->show();
createView ((KTextEditor::Document*)activeView()->document());
updateViewSpaceActions ();
}
示例2: updatePosition
void updatePosition()
{
int x, y;
QRect widgetRect = mWidget->geometry();
int splitterWidth = mSplitter->width();
int handleWidth = mSplitter->handleWidth();
int width = q->width();
if (!isVertical()) {
// FIXME: Make this configurable
y = 30;
if (mDirection == LTR) {
if (isVisible()) {
x = widgetRect.right() + handleWidth;
} else {
x = 0;
}
} else { // RTL
if (isVisible()) {
x = widgetRect.left() - handleWidth - width;
} else {
x = splitterWidth - handleWidth - width;
}
}
} else {
// FIXME
x = 0;
y = 0;
}
q->move(x, y);
}
示例3: QWidget
/*!
* \brief Creates a manager with given \a parent.
*/
QToolWindowManager::QToolWindowManager(QWidget *parent) :
QWidget(parent, 0)
{
d_ptr = new QToolWindowManagerPrivate();
d_ptr->q_ptr = this;
Q_D(QToolWindowManager);
d->slots_object.d = d;
d->m_lastUsedArea = 0;
d->m_borderSensitivity = 12;
QSplitter *testSplitter = new QSplitter();
d->m_rubberBandLineWidth = testSplitter->handleWidth();
delete testSplitter;
d->m_dragIndicator = new QLabel(0, Qt::ToolTip );
d->m_dragIndicator->setAttribute(Qt::WA_ShowWithoutActivating);
QVBoxLayout* mainLayout = new QVBoxLayout(this);
mainLayout->setContentsMargins(0, 0, 0, 0);
QToolWindowManagerWrapper* wrapper = new QToolWindowManagerWrapper(this);
wrapper->setWindowFlags(wrapper->windowFlags() & ~Qt::Tool);
mainLayout->addWidget(wrapper);
connect(&(d->m_dropSuggestionSwitchTimer), SIGNAL(timeout()),
&(d->slots_object), SLOT(showNextDropSuggestion()));
d->m_dropSuggestionSwitchTimer.setInterval(1000);
d->m_dropCurrentSuggestionIndex = 0;
d->m_rectRubberBand = new QRubberBand(QRubberBand::Rectangle, this);
d->m_lineRubberBand = new QRubberBand(QRubberBand::Line, this);
}
示例4: createWidgets
void ViewWidget::createWidgets()
{
mSplitter = new QSplitter(this);
QSplitter splitter;
mSplitter->setHandleWidth(2*splitter.handleWidth());
mIG = new InspectorGadget(this);
mIG->setMinimumSize(300,400);
mIGPrecisionDlg = new IGPrecisionDialog(this);
}
示例5: createWidgets
void ModelExplorer::createWidgets()
{
mTreeViewWidget = new TreeViewWidget(this);
mClassViewWidget = new ClassViewWidget(this);
mObjectExplorer = new ObjectExplorer(mIddFile,this);
mStackedWidget = new QStackedWidget(this);
mSplitter = new QSplitter(Qt::Vertical,this);
QSplitter splitter;
mSplitter->setHandleWidth(2*splitter.handleWidth());
mSplitter->addWidget(mStackedWidget);
mSplitter->addWidget(mObjectExplorer);
}
示例6: QWidget
ToolWindowManager::ToolWindowManager(QWidget *parent) :
QWidget(parent)
{
m_borderSensitivity = 12;
QSplitter* testSplitter = new QSplitter();
m_rubberBandLineWidth = testSplitter->handleWidth();
delete testSplitter;
m_dragIndicator = new QLabel(0, Qt::ToolTip );
m_dragIndicator->setAttribute(Qt::WA_ShowWithoutActivating);
QVBoxLayout* mainLayout = new QVBoxLayout(this);
mainLayout->setContentsMargins(0, 0, 0, 0);
ToolWindowManagerWrapper* wrapper = new ToolWindowManagerWrapper(this);
wrapper->setWindowFlags(wrapper->windowFlags() & ~Qt::Tool);
mainLayout->addWidget(wrapper);
connect(&m_dropSuggestionSwitchTimer, SIGNAL(timeout()),
this, SLOT(showNextDropSuggestion()));
m_dropSuggestionSwitchTimer.setInterval(1000);
m_dropCurrentSuggestionIndex = 0;
m_allowFloatingWindow = true;
m_rectRubberBand = new QRubberBand(QRubberBand::Rectangle, this);
m_lineRubberBand = new QRubberBand(QRubberBand::Line, this);
}
示例7: createChildWidgets
//.........这里部分代码省略.........
if( value == Rating )
{
int rating = textIndex.data( Qt::DisplayRole ).toInt();
KRatingWidget* ratingWidget = new KRatingWidget( 0 );
ratingWidget->setAlignment( element.alignment() );
ratingWidget->setRating( rating );
ratingWidget->setAttribute( Qt::WA_NoMousePropagation, true );
connect( ratingWidget, SIGNAL(ratingChanged(uint)), this, SLOT(ratingValueChanged()) );
m_editorRoleMap.insert( ratingWidget, value );
widget = ratingWidget;
}
else if( value == Divider )
{
QPixmap left = The::svgHandler()->renderSvg( "divider_left",
1, rowHeight,
"divider_left" );
QPixmap right = The::svgHandler()->renderSvg( "divider_right",
1, rowHeight,
"divider_right" );
QPixmap dividerPixmap( 2, rowHeight );
dividerPixmap.fill( Qt::transparent );
QPainter painter( ÷rPixmap );
painter.drawPixmap( 0, 0, left );
painter.drawPixmap( 1, 0, right );
QLabel* dividerLabel = new QLabel( 0 );
dividerLabel->setPixmap( dividerPixmap );
dividerLabel->setAlignment( element.alignment() );
widget = dividerLabel;
}
else if( value == Moodbar )
{
//we cannot ask the model for the moodbar directly as we have no
//way of asking for a specific size. Instead just get the track from
//the model and ask the moodbar manager ourselves.
Meta::TrackPtr track = m_index.data( TrackRole ).value<Meta::TrackPtr>();
QLabel* moodbarLabel = new QLabel( 0 );
moodbarLabel->setScaledContents( true );
if( The::moodbarManager()->hasMoodbar( track ) )
{
QPixmap moodbar = The::moodbarManager()->getMoodbar( track, itemWidth, rowHeight - 8 );
moodbarLabel->setPixmap( moodbar );
}
widget = moodbarLabel;
}
//actual playlist item text is drawn here
else
{
QLineEdit * edit = new QLineEdit( text, 0 );
edit->setFrame( false );
edit->setAlignment( element.alignment() );
edit->installEventFilter(this);
// -- set font
bool bold = element.bold();
bool italic = element.italic();
bool underline = element.underline();
QFont font = edit->font();
font.setBold( bold );
font.setItalic( italic );
font.setUnderline( underline );
edit->setFont( font );
connect( edit, SIGNAL(editingFinished()), this, SLOT(editValueChanged()) );
//check if this is a column that is editable. If not, make the
//line edit read only.
if( !isEditableColumn( static_cast<Playlist::Column>(value) ) )
{
edit->setReadOnly( true );
edit->setDisabled( true );
}
m_editorRoleMap.insert( edit, value );
widget = edit;
}
widget->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Ignored ); // or else the widget size hint influences the space it get's which messes up the layout
rowWidget->addWidget( widget );
// handles are nice, but if we don't compensate for their sizes the layout
// would be different from the item delegate
if( j > 0 )
widget->setContentsMargins( -( ( rowWidget->handleWidth() + 1 ) / 2 ), 0, 0, 0 );
if( j < elementCount - 1 )
widget->setContentsMargins( 0, 0, -( rowWidget->handleWidth() / 2 ), 0 );
currentItemX += itemWidth;
}
rowWidget->setSizes( itemWidths );
}
}
示例8: split
void SplitView::split(BufferView* view, Qt::Orientation orientation)
{
if (view) {
QSplitter* container = qobject_cast<QSplitter*>(view->parentWidget());
if (container) {
int index = container->indexOf(view);
BufferView* bv = 0;
const int size = (orientation == Qt::Horizontal ? container->width() : container->height()) - container->handleWidth();
if (container->count() == 1 || container->orientation() == orientation) {
container->setOrientation(orientation);
bv = createBufferView(container, index + 1);
QList<int> sizes;
for (int i = 0; i < container->count(); ++i)
sizes += size / container->count();
container->setSizes(sizes);
} else if (index != -1) {
QList<int> sizes = container->sizes();
QSplitter* splitter = wrap(view, orientation);
if (splitter) {
container->setSizes(sizes);
bv = createBufferView(splitter);
splitter->setSizes(QList<int>() << size/2 << size/2);
}
}
if (bv) {
bv->setBuffer(view->buffer());
emit viewAdded(bv);
}
}
}
}