本文整理汇总了C++中QPtrList::findRef方法的典型用法代码示例。如果您正苦于以下问题:C++ QPtrList::findRef方法的具体用法?C++ QPtrList::findRef怎么用?C++ QPtrList::findRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPtrList
的用法示例。
在下文中一共展示了QPtrList::findRef方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nextToolView
void DockContainer::nextToolView()
{
QPtrList< KMultiTabBarTab > *tabs = m_tb->tabs();
int pos = tabs->findRef(m_tb->tab(oldtab));
if(pos == -1)
return;
pos++;
if(pos >= (int)tabs->count())
pos = 0;
KMultiTabBarTab *tab = tabs->at(pos);
if(!tab)
return; // can never happen here, but who knows
m_tb->setTab(tab->id(), true);
tabClicked(tab->id());
}
示例2: prevToolView
void KMdiDockContainer::prevToolView()
{
kdDebug( 760 ) << k_funcinfo << endl;
QPtrList<KMultiTabBarTab>* tabs = m_tb->tabs();
int pos = tabs->findRef( m_tb->tab( oldtab ) );
if ( pos == -1 )
return ;
pos--;
if ( pos < 0 )
pos = tabs->count() - 1;
KMultiTabBarTab *tab = tabs->at( pos );
if ( !tab )
return ; //can never happen here, but who knows
m_tb->setTab( tab->id(), true );
tabClicked( tab->id() );
}
示例3: findDockWindow
QDockArea::DockWindowData *QDockArea::dockWindowData( QDockWindow *w )
{
DockWindowData *data = new DockWindowData;
data->index = findDockWindow( w );
if ( data->index == -1 ) {
delete data;
return 0;
}
QPtrList<QDockWindow> lineStarts = layout->lineStarts();
int i = -1;
for ( QDockWindow *dw = dockWindows->first(); dw; dw = dockWindows->next() ) {
if ( lineStarts.findRef( dw ) != -1 )
++i;
if ( dw == w )
break;
}
data->line = i;
data->offset = point_pos( QPoint( fix_x(w), w->y() ), orientation() );
data->area = this;
data->fixedExtent = w->fixedExtent();
return data;
}
示例4: removeDockWindow
void QDockArea::removeDockWindow( QDockWindow *w, bool makeFloating, bool swap, bool fixNewLines )
{
w->removeEventFilter( this );
QDockWindow *dockWindow = 0;
int i = findDockWindow( w );
if ( i == -1 )
return;
dockWindow = dockWindows->at( i );
dockWindows->remove( i );
QPtrList<QDockWindow> lineStarts = layout->lineStarts();
if ( fixNewLines && lineStarts.findRef( dockWindow ) != -1 && i < (int)dockWindows->count() )
dockWindows->at( i )->setNewLine( TRUE );
if ( makeFloating ) {
QWidget *p = parentWidget() ? parentWidget() : topLevelWidget();
dockWindow->reparent( p, WType_Dialog | WStyle_Customize | WStyle_NoBorder | WStyle_Tool, QPoint( 0, 0 ), FALSE );
}
if ( swap )
dockWindow->resize( dockWindow->height(), dockWindow->width() );
updateLayout();
if ( dockWindows->isEmpty() )
setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) );
}
示例5: setTabEnabled
void KTabBar::setTabEnabled( int id, bool enabled )
{
QTab * t = tab( id );
if ( t ) {
if ( t->isEnabled() != enabled ) {
t->setEnabled( enabled );
QRect r( t->rect() );
if ( !enabled && id == currentTab() && count()>1 ) {
int index = indexOf( id );
index += ( index+1 == count() ) ? -1 : 1;
t = tabAt( index );
if ( t->isEnabled() ) {
r = r.unite( t->rect() );
QPtrList<QTab> *tablist = tabList();
tablist->append( tablist->take( tablist->findRef( t ) ) );
emit selected( t->identifier() );
}
}
repaint( r );
}
}
}
示例6: moveDockWindow
void QDockArea::moveDockWindow( QDockWindow *w, const QPoint &p, const QRect &r, bool swap )
{
invalidateFixedSizes();
int mse = -10;
bool hasResizable = FALSE;
for ( QDockWindow *dw = dockWindows->first(); dw; dw = dockWindows->next() ) {
if ( dw->isHidden() )
continue;
if ( dw->isResizeEnabled() )
hasResizable = TRUE;
if ( orientation() != Qt::Horizontal )
mse = QMAX( QMAX( dw->fixedExtent().width(), dw->width() ), mse );
else
mse = QMAX( QMAX( dw->fixedExtent().height(), dw->height() ), mse );
}
if ( !hasResizable && w->isResizeEnabled() ) {
if ( orientation() != Qt::Horizontal )
mse = QMAX( w->fixedExtent().width(), mse );
else
mse = QMAX( w->fixedExtent().height(), mse );
}
QDockWindow *dockWindow = 0;
int dockWindowIndex = findDockWindow( w );
QPtrList<QDockWindow> lineStarts = layout->lineStarts();
QValueList<QRect> lines = layout->lineList();
bool wasAloneInLine = FALSE;
QPoint pos = mapFromGlobal( p );
QRect lr = *lines.at( lineOf( dockWindowIndex ) );
if ( dockWindowIndex != -1 ) {
if ( lineStarts.find( w ) != -1 &&
( dockWindowIndex < (int)dockWindows->count() - 1 && lineStarts.find( dockWindows->at( dockWindowIndex + 1 ) ) != -1 ||
dockWindowIndex == (int)dockWindows->count() - 1 ) )
wasAloneInLine = TRUE;
dockWindow = dockWindows->take( dockWindowIndex );
if ( !wasAloneInLine ) { // only do the pre-layout if the widget isn't the only one in its line
if ( lineStarts.findRef( dockWindow ) != -1 && dockWindowIndex < (int)dockWindows->count() )
dockWindows->at( dockWindowIndex )->setNewLine( TRUE );
layout->layoutItems( QRect( 0, 0, width(), height() ), TRUE );
}
} else {
dockWindow = w;
dockWindow->reparent( this, QPoint( 0, 0 ), TRUE );
if ( swap )
dockWindow->resize( dockWindow->height(), dockWindow->width() );
w->installEventFilter( this );
}
lineStarts = layout->lineStarts();
lines = layout->lineList();
QRect rect = QRect( mapFromGlobal( r.topLeft() ), r.size() );
if ( orientation() == Horizontal && QApplication::reverseLayout() ) {
rect = QRect( width() - rect.x() - rect.width(), rect.y(), rect.width(), rect.height() );
pos.rx() = width() - pos.x();
}
dockWindow->setOffset( point_pos( rect.topLeft(), orientation() ) );
if ( orientation() == Horizontal ) {
int offs = dockWindow->offset();
if ( width() - offs < dockWindow->minimumWidth() )
dockWindow->setOffset( width() - dockWindow->minimumWidth() );
} else {
int offs = dockWindow->offset();
if ( height() - offs < dockWindow->minimumHeight() )
dockWindow->setOffset( height() - dockWindow->minimumHeight() );
}
if ( dockWindows->isEmpty() ) {
dockWindows->append( dockWindow );
} else {
int dockLine = -1;
bool insertLine = FALSE;
int i = 0;
QRect lineRect;
// find the line which we touched with the mouse
for ( QValueList<QRect>::Iterator it = lines.begin(); it != lines.end(); ++it, ++i ) {
if ( point_pos( pos, orientation(), TRUE ) >= point_pos( (*it).topLeft(), orientation(), TRUE ) &&
point_pos( pos, orientation(), TRUE ) <= point_pos( (*it).topLeft(), orientation(), TRUE ) +
size_extent( (*it).size(), orientation(), TRUE ) ) {
dockLine = i;
lineRect = *it;
break;
}
}
if ( dockLine == -1 ) { // outside the dock...
insertLine = TRUE;
if ( point_pos( pos, orientation(), TRUE ) < 0 ) // insert as first line
dockLine = 0;
else
dockLine = (int)lines.count(); // insert after the last line ### size_t/int cast
} else { // inside the dock (we have found a dockLine)
if ( point_pos( pos, orientation(), TRUE ) <
point_pos( lineRect.topLeft(), orientation(), TRUE ) + 4 ) { // mouse was at the very beginning of the line
insertLine = TRUE; // insert a new line before that with the docking widget
} else if ( point_pos( pos, orientation(), TRUE ) >
point_pos( lineRect.topLeft(), orientation(), TRUE ) +
size_extent( lineRect.size(), orientation(), TRUE ) - 4 ) { // mouse was at the very and of the line
insertLine = TRUE; // insert a line after that with the docking widget
dockLine++;
}
//.........这里部分代码省略.........