本文整理汇总了C++中KDockWidget类的典型用法代码示例。如果您正苦于以下问题:C++ KDockWidget类的具体用法?C++ KDockWidget怎么用?C++ KDockWidget使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KDockWidget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dockToolViewsIntoContainers
void MainWindow::dockToolViewsIntoContainers(QPtrList<KDockWidget>& widgetsToReparent,KDockWidget *container) {
for ( KDockWidget *dw = widgetsToReparent.first(); dw;
dw=widgetsToReparent.next()){
dw->manualDock(container,KDockWidget::DockCenter,20);
dw->loseFormerBrotherDockWidget();
}
}
示例2: tabClicked
void DockContainer::removeWidget(KDockWidget *dwdg)
{
KDockWidget *w = (KDockWidget *)dwdg;
if(!m_map.contains(w))
return;
int id = m_map[w];
if(m_tb->isTabRaised(id))
{
// why do we hide the tab if we're just going
// to remove it? - mattr 2004-10-26
m_tb->setTab(id, false);
m_tabSwitching = false;
tabClicked(id);
}
m_tb->removeTab(id);
m_ws->removeWidget(w);
m_map.remove(w);
m_revMap.remove(id);
if(m_overlapButtons.contains(w))
{
(static_cast< KDockWidgetHeader * >(w->getHeader()->qt_cast("KDockWidgetHeader")))->removeButton(m_overlapButtons[w]);
m_overlapButtons.remove(w);
}
KDockContainer::removeWidget(w);
itemNames.remove(w->name());
tabCaptions.remove(w->name());
tabTooltips.remove(w->name());
if(!itemNames.count())
((KDockWidget *)parentWidget())->undock();
}
示例3: isVisible
KMDI::ToolViewAccessor *MainWindow::addToolWindow( QWidget* pWnd, KDockWidget::DockPosition pos, QWidget* pTargetWnd, int percent, const QString& tabToolTip, const QString& tabCaption)
{
QWidget *tvta=pWnd;
KDockWidget* pDW = dockManager->getDockWidgetFromName(pWnd->name());
if (pDW) {
// probably readDockConfig already created the widgetContainer, use that
pDW->setWidget(pWnd);
if (pWnd->icon()) {
pDW->setPixmap(*pWnd->icon());
}
pDW->setTabPageLabel((tabCaption==0)?pWnd->caption():tabCaption);
pDW->setToolTipString(tabToolTip);
dockManager->removeFromAutoCreateList(pDW);
pWnd=pDW;
}
QRect r=pWnd->geometry();
KMDI::ToolViewAccessor *mtva=new KMDI::ToolViewAccessor(this,pWnd,tabToolTip,(tabCaption==0)?pWnd->caption():tabCaption);
m_toolViews->insert(tvta,mtva);
if (pos == KDockWidget::DockNone) {
mtva->d->widgetContainer->setEnableDocking(KDockWidget::DockNone);
mtva->d->widgetContainer->reparent(this, Qt::WType_TopLevel | Qt::WType_Dialog, r.topLeft(), isVisible());
} else { // add (and dock) the toolview as DockWidget view
//const QPixmap& wndIcon = pWnd->icon() ? *(pWnd->icon()) : QPixmap();
//KDockWidget *pCover=mtva->d->widgetContainer;
mtva->place(pos, pTargetWnd,percent);
}
return mtva;
}
示例4: kdDebug
void KMdiDockContainer::removeWidget( KDockWidget* dwdg )
{
KDockWidget * w = dwdg;
if ( !m_map.contains( w ) )
return; //we don't have this widget in our container
kdDebug( 760 ) << k_funcinfo << endl;
//lower the tab. ( TODO: needed? )
int id = m_map[ w ];
if ( m_tb->isTabRaised( id ) )
{
m_tb->setTab( id, false );
tabClicked( id );
}
m_tb->removeTab( id );
m_ws->removeWidget( w );
m_map.remove( w );
m_revMap.remove( id );
if ( m_overlapButtons.contains( w ) )
{
( ::tqqt_cast<KDockWidgetHeader*>( w->getHeader() ) )->removeButton( m_overlapButtons[ w ] );
m_overlapButtons.remove( w );
}
KDockContainer::removeWidget( w );
itemNames.remove( w->name() );
tabCaptions.remove( w->name() );
tabTooltips.remove( w->name() );
hideIfNeeded();
}
示例5: Q_ASSERT
void ToolViewAccessor::place(KDockWidget::DockPosition pos, QWidget* pTargetWnd ,int percent)
{
Q_ASSERT(d->widgetContainer);
if (!d->widgetContainer) return;
if (pos == KDockWidget::DockNone) {
d->widgetContainer->setEnableDocking(KDockWidget::DockNone);
d->widgetContainer->reparent(mdiMainFrm, Qt::WType_TopLevel | Qt::WType_Dialog, QPoint(0,0), mdiMainFrm->isVisible());
}
else { // add (and dock) the toolview as DockWidget view
KDockWidget* pCover = d->widgetContainer;
KDockWidget* pTargetDock = 0L;
if (pTargetWnd->inherits("KDockWidget") || pTargetWnd->inherits("KDockWidget_Compat::KDockWidget")) {
pTargetDock = (KDockWidget*) pTargetWnd;
}
// Should we dock to ourself?
bool DockToOurself = false;
if (mdiMainFrm->getMainDockWidget()) {
if (pTargetWnd == mdiMainFrm->getMainDockWidget()->getWidget()) {
DockToOurself = true;
pTargetDock = mdiMainFrm->getMainDockWidget();
}
else if (pTargetWnd == mdiMainFrm->getMainDockWidget()) {
DockToOurself = true;
pTargetDock = mdiMainFrm->getMainDockWidget();
}
}
// this is not inheriting QWidget*, its plain impossible that this condition is true
//if (pTargetWnd == this) DockToOurself = true;
if (!DockToOurself) if(pTargetWnd != 0L) {
pTargetDock = mdiMainFrm->dockManager->findWidgetParentDock( pTargetWnd);
if (!pTargetDock) {
if (pTargetWnd->parentWidget()) {
pTargetDock = mdiMainFrm->dockManager->findWidgetParentDock( pTargetWnd->parentWidget());
}
}
}
/* if (!pTargetDock || pTargetWnd == mdiMainFrm->getMainDockWidget()) {
if (mdiMainFrm->m_managedDockPositionMode && (mdiMainFrm->m_pMdi || mdiMainFrm->m_documentTabWidget)) {
KDockWidget *dw1=pTargetDock->findNearestDockWidget(pos);
if (dw1)
pCover->manualDock(dw1,KDockWidget::DockCenter,percent);
else
pCover->manualDock ( pTargetDock, pos, 20 );
return;
}
}*/ //TODO
pCover->manualDock( pTargetDock, pos, percent);
//check pCover->show();
}
}
示例6: statusBar
/**
* Positions child widgets into their docking stations, and performs some
* other main window initialisation.
*/
void KScope::initMainWindow()
{
KStatusBar* pStatus;
KDockWidget* pMainDock;
QPopupMenu* pPopup;
// Create the status bar
pStatus = statusBar();
pStatus->insertItem(i18n(" Line: N/A Col: N/A "), 0, 0, true);
// Create the main dock for the editor tabs widget
pMainDock = createDockWidget("Editors Window", QPixmap());
pMainDock->setWidget(m_pEditTabs);
pMainDock->setDockSite(KDockWidget::DockCorner);
setMainDockWidget(pMainDock);
setView(pMainDock);
pMainDock->setEnableDocking(KDockWidget::DockNone);
// Create the query window dock
m_pQueryDock->setWidget(m_pQueryWidget);
m_pQueryDock->manualDock(pMainDock, KDockWidget::DockBottom, 65);
// Update the relevant shell action when the dock is hidden through its
// close button
connect(m_pQueryDock, SIGNAL(headerCloseButtonClicked()), m_pActions,
SLOT(slotQueryDockClosed()));
// Create the file view dock
m_pFileViewDock->setWidget(m_pFileView);
m_pFileViewDock->manualDock(pMainDock, KDockWidget::DockRight, 80);
// Update the relevant shell action when the dock is hidden through its
// close button
connect(m_pFileViewDock, SIGNAL(headerCloseButtonClicked()), m_pActions,
SLOT(slotFileViewDockClosed()));
// Associate the "Window" menu with the editor tabs widdget
pPopup = (QPopupMenu*)factory()->container("window", this);
m_pEditTabs->setWindowMenu(pPopup);
// Associate the "Query" popup menu with the query widget
pPopup = (QPopupMenu*)factory()->container("query_popup", this);
m_pQueryWidget->setPageMenu(pPopup, m_pActions->getLockAction());
// Restore dock configuration
Config().loadWorkspace(this);
m_bHideQueryOnSelection = m_pQueryDock->isHidden();
m_pActions->initLayoutActions();
}
示例7: while
KMdiDockContainer::~KMdiDockContainer()
{
TQMap<KDockWidget*, int>::iterator it;
while ( m_map.count() )
{
it = m_map.begin();
KDockWidget *w = it.key();
if ( m_overlapButtons.contains( w ) )
{
( ::tqqt_cast<KDockWidgetHeader*>( w->getHeader() ) )->removeButton( m_overlapButtons[w] );
m_overlapButtons.remove( w );
}
m_map.remove( w );
w->undock();
}
deactivated( this );
}
示例8: setToolViewStyle
void MainWindow::setToolViewStyle(int flag)
{
d->m_styleIDEAlMode = flag; // see KMultiTabBar for the first 3 bits
DockContainer *tmpL=(DockContainer*) (m_leftContainer->getWidget()->qt_cast("KMDI::DockContainer"));
if (tmpL) tmpL->setStyle(flag);
DockContainer *tmpR=(DockContainer*) (m_rightContainer->getWidget()->qt_cast("KMDI::DockContainer"));
if (tmpR) tmpR->setStyle(flag);
DockContainer *tmpT=(DockContainer*) (m_topContainer->getWidget()->qt_cast("KMDI::DockContainer"));
if (tmpT) tmpT->setStyle(flag);
DockContainer *tmpB=(DockContainer*) (m_bottomContainer->getWidget()->qt_cast("KMDI::DockContainer"));
if (tmpB) tmpB->setStyle(flag);
d->m_toolviewStyle = flag;
bool toolviewExists = false;
QMap<QWidget*,KMDI::ToolViewAccessor*>::Iterator it;
for (it = m_toolViews->begin(); it != m_toolViews->end(); ++it) {
KDockWidget *dockWidget = dynamic_cast<KDockWidget*>(it.data()->wrapperWidget());
if (dockWidget) {
if (flag == KMDI::IconOnly)
{
dockWidget->setTabPageLabel(" ");
dockWidget->setPixmap(*(it.data()->wrappedWidget()->icon()));
} else
if (flag == KMDI::TextOnly)
{
dockWidget->setPixmap(); //FIXME: Does not hide the icon in the IDEAl mode.
dockWidget->setTabPageLabel(it.data()->wrappedWidget()->caption());
} else
if (flag == KMDI::TextAndIcon)
{
dockWidget->setPixmap(*(it.data()->wrappedWidget()->icon()));
dockWidget->setTabPageLabel(it.data()->wrappedWidget()->caption());
}
toolviewExists = true;
}
}
if (toolviewExists)
{
//workaround for the above FIXME to make switching to TextOnly mode work in IDEAl as well. Be sure that this version of switch* is called.
if (flag == KMDI::TextOnly)
{
/* MainWindow::switchToTabPageMode();
MainWindow::switchToIDEAlMode();*/ //TODO
} else
{
writeDockConfig();
readDockConfig();
}
}
}
示例9: TQString
void KMdiDockContainer::load( TDEConfig* cfg, const TQString& group_or_prefix )
{
TQString grp = cfg->group();
cfg->setGroup( group_or_prefix + TQString( "::%1" ).arg( parent() ->name() ) );
if ( cfg->readEntry( "overlapMode" ) != "false" )
activateOverlapMode( m_horizontal?m_tb->height():m_tb->width() );
else
deactivateOverlapMode();
m_separatorPos = cfg->readNumEntry( "separatorPosition", 18000 );
int i = 0;
TQString raise;
while ( true )
{
TQString dwn = cfg->readEntry( TQString( "widget%1" ).arg( i ) );
if ( dwn.isEmpty() )
break;
kdDebug( 760 ) << k_funcinfo << "configuring dockwidget :" << dwn << endl;
KDockWidget *dw = ( ( KDockWidget* ) parent() ) ->dockManager() ->getDockWidgetFromName( dwn );
if ( dw )
{
TQString s = cfg->readEntry( TQString( "widget%1-tabCaption" ).arg( i ) );
if ( !s.isEmpty() )
{
dw->setTabPageLabel( s );
}
s = cfg->readEntry( TQString( "widget%1-tabTooltip" ).arg( i ) );
if ( !s.isEmpty() )
{
dw->setToolTipString( s );
}
dw->manualDock( ( KDockWidget* ) parent(), KDockWidget::DockCenter );
}
if ( cfg->readBoolEntry( dwn, false ) )
raise = dwn;
i++;
}
TQPtrList<KMultiTabBarTab>* tl = m_tb->tabs();
TQPtrListIterator<KMultiTabBarTab> it1( *tl );
m_ws->hide();
if ( !m_horizontal )
parentDockWidget() ->setForcedFixedWidth( m_tb->width() );
else
parentDockWidget() ->setForcedFixedHeight( m_tb->height() );
for ( ;it1.current() != 0;++it1 )
{
m_tb->setTab( it1.current() ->id(), false );
}
kapp->syncX();
m_delayedRaise = -1;
for ( TQMap<KDockWidget*, KDockButton_Private*>::iterator it = m_overlapButtons.begin();
it != m_overlapButtons.end();++it )
it.data() ->setOn( !isOverlapMode() );
if ( !raise.isEmpty() )
{
for ( TQMap<KDockWidget*, int>::iterator it = m_map.begin();it != m_map.end();++it )
{
if ( it.key() ->name() == raise )
{
/* tabClicked(it.data());
m_tb->setTab(it.data(),true);
tabClicked(it.data());
m_ws->raiseWidget(it.key());
kapp->sendPostedEvents();
kapp->syncX();*/
m_delayedRaise = it.data();
TQTimer::singleShot( 0, this, TQT_SLOT( delayedRaise() ) );
kdDebug( 760 ) << k_funcinfo << "raising" << it.key() ->name() << endl;
break;
}
}
}
if ( m_delayedRaise == -1 )
TQTimer::singleShot( 0, this, TQT_SLOT( init() ) );
cfg->setGroup( grp );
}
示例10: activateOverlapMode
void KMdiDockContainer::load( TQDomElement& dockEl )
{
TQString raise;
for ( TQDomNode n = dockEl.firstChild();!n.isNull();n = n.nextSibling() )
{
TQDomElement el = n.toElement();
if ( el.isNull() )
continue;
if ( el.tagName() == "overlapMode" )
{
if ( el.attribute( "overlapMode" ) != "false" )
activateOverlapMode( m_horizontal?m_tb->height():m_tb->width() );
else
deactivateOverlapMode();
}
else if ( el.tagName() == "child" )
{
KDockWidget * dw = ( ( KDockWidget* ) parent() ) ->dockManager() ->getDockWidgetFromName( el.text() );
if ( dw )
{
if ( el.hasAttribute( "tabCaption" ) )
{
dw->setTabPageLabel( el.attribute( "tabCaption" ) );
}
if ( el.hasAttribute( "tabTooltip" ) )
{
dw->setToolTipString( el.attribute( "tabTooltip" ) );
}
dw->manualDock( ( KDockWidget* ) parent(), KDockWidget::DockCenter );
}
}
}
TQPtrList<KMultiTabBarTab>* tl = m_tb->tabs();
TQPtrListIterator<KMultiTabBarTab> it1( *tl );
m_ws->hide();
if ( !m_horizontal )
parentDockWidget()->setForcedFixedWidth( m_tb->width() );
else
parentDockWidget()->setForcedFixedHeight( m_tb->height() );
for ( ;it1.current() != 0;++it1 )
m_tb->setTab( it1.current() ->id(), false );
kapp->syncX();
m_delayedRaise = -1;
for ( TQMap<KDockWidget*, KDockButton_Private*>::iterator it = m_overlapButtons.begin();
it != m_overlapButtons.end();++it )
it.data() ->setOn( !isOverlapMode() );
if ( !raise.isEmpty() )
{
for ( TQMap<KDockWidget*, int>::iterator it = m_map.begin();it != m_map.end();++it )
{
if ( it.key() ->name() == raise )
{
m_delayedRaise = it.data();
TQTimer::singleShot( 0, this, TQT_SLOT( delayedRaise() ) );
kdDebug( 760 ) << k_funcinfo << "raising " << it.key()->name() << endl;
break;
}
}
}
if ( m_delayedRaise == -1 )
TQTimer::singleShot( 0, this, TQT_SLOT( init() ) );
}
示例11: switch
bool KMdiDockContainer::eventFilter( TQObject *obj, TQEvent *event )
{
switch ( event->type() )
{
case TQEvent::MouseButtonPress:
{
KMultiTabBarTab* kmtbTab = tqt_dynamic_cast<KMultiTabBarTab*>( obj );
if ( !kmtbTab )
{
kdDebug(760) << k_funcinfo << "Got a mouse button press but we have no tab" << endl;
break;
}
KDockWidget* w = m_revMap[ kmtbTab->id() ];
if ( !w )
{
kdDebug(760) << k_funcinfo << "Got a mouse button press but we have no widget" << endl;
break;
}
if ( !w->getHeader() )
{
kdDebug(760) << k_funcinfo << "Got a mouse button press but we have no header" << endl;
break;
}
KDockWidgetHeader *hdr = ::tqqt_cast<KDockWidgetHeader*>( w->getHeader() );
if ( !hdr )
{
kdDebug(760) << "Wrong header type in KMdiDockContainer::eventFilter" << endl;
break;
}
m_dockManager = w->dockManager();
m_dragPanel = TQT_TQOBJECT(hdr->dragPanel());
if ( m_dragPanel )
m_movingState = WaitingForMoveStart;
delete m_startEvent;
m_startEvent = new TQMouseEvent( * ( ( TQMouseEvent* ) event ) );
}
break;
case TQEvent::MouseButtonRelease:
if ( m_movingState == Moving )
{
m_movingState = NotMoving;
TQApplication::postEvent( m_dragPanel, new TQMouseEvent( * ( ( TQMouseEvent* ) event ) ) );
delete m_startEvent;
m_startEvent = 0;
}
case TQEvent::MouseMove:
if ( m_movingState == WaitingForMoveStart )
{
TQPoint p( ( ( TQMouseEvent* ) event )->pos() - m_startEvent->pos() );
if ( p.manhattanLength() > TDEGlobalSettings::dndEventDelay() )
{
m_dockManager->eventFilter( m_dragPanel, TQT_TQEVENT(m_startEvent) );
m_dockManager->eventFilter( m_dragPanel, event );
m_movingState = Moving;
}
}
else if ( m_movingState == Moving )
m_dockManager->eventFilter( m_dragPanel, event );
break;
default:
break;
}
return false;
}
示例12: kdDebug
void DockContainer::tabClicked(int t)
{
kdDebug(760) << "DockContainer::tabClicked()" << endl;
bool call_makeVisible = !m_tabSwitching;
m_tabSwitching = true;
if((t != -1) && m_tb->isTabRaised(t))
{
if(m_ws->isHidden())
{
m_ws->show();
parentDockWidget()->restoreFromForcedFixedSize();
}
if(!m_ws->widget(t))
{
m_revMap[t]->manualDock(parentDockWidget(), KDockWidget::DockCenter, 20);
if(call_makeVisible)
m_revMap[t]->makeDockVisible(); // manualDock(parentDockWidget(),KDockWidget::DockCenter,20);
m_tabSwitching = false;
emit activated(this);
return;
}
m_ws->raiseWidget(t);
if(m_ws->widget(t))
{
KDockWidget *tmpDw = static_cast< KDockWidget * >(m_ws->widget(t)->qt_cast("KDockWidget"));
if(tmpDw)
{
if(tmpDw->getWidget())
tmpDw->getWidget()->setFocus();
}
else
kdDebug(760) << "Something really weird is going on" << endl;
}
else
kdDebug(760) << "DockContainer::tabClicked(int): m_ws->widget(t)==0 " << endl;
if(oldtab != t)
m_tb->setTab(oldtab, false);
m_tabSwitching = true;
oldtab = t;
emit activated(this);
}
else
{
// try save splitter position
if(parentDockWidget() && parentDockWidget()->parent())
{
KDockSplitter *sp = static_cast< KDockSplitter * >(parentDockWidget()->parent()->qt_cast("KDockSplitter"));
if(sp)
m_separatorPos = sp->separatorPos();
}
m_previousTab = t;
// oldtab=-1;
if(m_block)
return;
emit deactivated(this);
m_block = true;
if(m_ws->widget(t))
{
// ((KDockWidget*)m_ws->widget(t))->undock();
}
m_block = false;
m_ws->hide();
kdDebug(760) << "Fixed Width:" << m_tb->width() << endl;
if(m_vertical)
parentDockWidget()->setForcedFixedWidth(m_tb->width()); // strange why it worked before at all
else
parentDockWidget()->setForcedFixedHeight(m_tb->height()); // strange why it worked before at all
}
m_tabSwitching = false;
}
示例13: parentDockWidget
bool DockContainer::eventFilter(QObject *obj, QEvent *event)
{
if(obj == m_tb)
{
if((event->type() == QEvent::Resize) && (m_ws->isHidden()))
{
QSize size = ((QResizeEvent *)event)->size();
if(m_vertical)
parentDockWidget()->setForcedFixedWidth(size.width());
else
parentDockWidget()->setForcedFixedHeight(size.height());
}
}
else
switch(event->type())
{
case QEvent::MouseButtonPress:
{
KDockWidget *w = m_revMap[dynamic_cast< KMultiTabBarTab * >(obj)->id()];
if(!w)
{
kdDebug() << "NoWidget" << endl;
break;
}
if(!w->getHeader())
{
kdDebug() << "NO HEADER" << endl;
break;
}
KDockWidgetHeader *hdr = static_cast< KDockWidgetHeader * >(w->getHeader()->qt_cast("KDockWidgetHeader"));
if(!hdr)
{
kdDebug() << "Wrong header type in DockContainer::eventFilter" << endl;
break;
}
m_dockManager = w->dockManager();
m_dragPanel = hdr->dragPanel();
if(m_dragPanel)
m_movingState = WaitingForMoveStart;
delete m_startEvent;
m_startEvent = new QMouseEvent(*((QMouseEvent *)event));
}
break;
case QEvent::MouseButtonRelease:
if(m_movingState == Moving)
{
m_movingState = NotMoving;
QApplication::postEvent(m_dragPanel, new QMouseEvent(*((QMouseEvent *)event)));
delete m_startEvent;
m_startEvent = 0;
}
break;
case QEvent::MouseMove:
if(m_movingState == WaitingForMoveStart)
{
QPoint p(((QMouseEvent *)event)->pos() - m_startEvent->pos());
if(p.manhattanLength() > KGlobalSettings::dndEventDelay())
{
m_dockManager->eventFilter(m_dragPanel, m_startEvent);
m_dockManager->eventFilter(m_dragPanel, event);
m_movingState = Moving;
}
}
else if(m_movingState == Moving)
{
m_dockManager->eventFilter(m_dragPanel, event);
}
break;
default:
break;
}
return false;
}
示例14: toMainWindow
//.........这里部分代码省略.........
this, SLOT ( delConnection() ), toolbar );
DisconnectButton->setEnabled ( false );
toolbar->addSeparator();
NeedConnection[new QToolButton ( QPixmap ( ( const char ** ) commit_xpm ),
"Commit connection",
"Commit connection",
this,SLOT ( commitButton() ),toolbar ) ] = NULL;
NeedConnection[new QToolButton ( QPixmap ( ( const char ** ) rollback_xpm ),
"Rollback connection",
"Rollback connection",
this,SLOT ( rollbackButton() ),toolbar ) ] = NULL;
toolbar->addSeparator();
ConnectionSelection = new QComboBox ( toolbar );
ConnectionSelection->setFixedWidth ( 200 );
ConnectionSelection->setFocusPolicy ( NoFocus );
connect ( ConnectionSelection, SIGNAL ( activated ( int ) ), this, SLOT ( changeConnection() ) );
menuBar() ->insertItem ( "&Tools", ToolsMenu, TO_TOOLS_MENU );
WindowsMenu = new QPopupMenu ( this );
WindowsMenu->setCheckable ( true );
connect ( WindowsMenu, SIGNAL ( aboutToShow() ), this, SLOT ( windowsMenu() ) );
menuBar() ->insertItem ( "&Window", WindowsMenu, TO_WINDOWS_MENU );
menuBar() ->insertSeparator();
menuBar() ->insertItem ( "&Help", HelpMenu, TO_HELP_MENU );
char buffer[100];
sprintf ( buffer, DEFAULT_TITLE, TOVERSION );
setCaption ( buffer );
#ifdef TO_KDE
KDockWidget *mainDock = createDockWidget ( buffer, QPixmap ( ( const char ** ) toramini_xpm ) );
Workspace = new QWorkspace ( mainDock );
mainDock->setWidget ( Workspace );
setView ( mainDock );
setMainDockWidget ( mainDock );
mainDock->setEnableDocking ( KDockWidget::DockNone );
#else
Workspace = new QWorkspace ( this );
setCentralWidget ( Workspace );
#endif
setIcon ( QPixmap ( ( const char ** ) toramini_xpm ) );
statusBar() ->message ( "Ready" );
menuBar() ->setItemEnabled ( TO_CLOSE_CONNECTION, false );
menuBar() ->setItemEnabled ( TO_FILE_COMMIT, false );
menuBar() ->setItemEnabled ( TO_FILE_ROLLBACK, false );
menuBar() ->setItemEnabled ( TO_FILE_CLEARCACHE, false );
DisconnectButton->setEnabled ( false );
for ( std::map<QToolButton *, toTool *>::iterator j = NeedConnection.begin();
j != NeedConnection.end();j++ )
( *j ).first->setEnabled ( false );
connect ( menuBar(), SIGNAL ( activated ( int ) ), this, SLOT ( commandCallback ( int ) ) );
RowLabel = new QLabel ( statusBar() );
statusBar() ->addWidget ( RowLabel, 0, true );
RowLabel->setMinimumWidth ( 60 );
RowLabel->hide();
ColumnLabel = new QLabel ( statusBar() );
statusBar() ->addWidget ( ColumnLabel, 0, true );
ColumnLabel->setMinimumWidth ( 60 );
示例15: createDockWidget
void MyFracWindow::createWidgets()
{
KDockWidget* dockMain = createDockWidget("main", NULL);
_tabWidget = new QTabWidget(dockMain);
dockMain->setWidget(_tabWidget);
_view2D = new ViewWidget(true, _tabWidget);
_tabWidget->addTab(_view2D, SmallIconSet("frtab2d"), i18n("2D View"));
_view3D = new View3DWidget(_tabWidget);
_tabWidget->addTab(_view3D, SmallIconSet("frtab3d"), i18n("3D View"));
_dockParams = createDockWidget("params", SmallIcon("frparams"), NULL,
i18n("Parameters"));
QWidget* params = createParamsDock(_dockParams);
_dockParams->setWidget(params);
_dockDisplay = createDockWidget("display", SmallIcon("frdisplay"), NULL,
i18n("Display"));
QWidget* display = createDisplayDock(_dockParams);
_dockDisplay->setWidget(display);
_dockPreview = createDockWidget("preview", SmallIcon("viewmag"), NULL, i18n("Preview"));
ViewWidget* preview = new ViewWidget(false, _dockPreview);
_dockPreview->setWidget(preview);
dockMain->setDockSite(KDockWidget::DockCorner);
dockMain->setEnableDocking(KDockWidget::DockNone);
setView(dockMain);
setMainDockWidget(dockMain);
KDockWidget* dock1 = _dockDisplay->manualDock(_dockParams, KDockWidget::DockCenter);
KDockWidget* dock2 = _dockPreview->manualDock(dock1, KDockWidget::DockBottom, 65);
dock2->manualDock(dockMain, KDockWidget::DockRight, 65);
connect(_tabWidget, SIGNAL(currentChanged(QWidget*)), this, SLOT(tabChanged()));
connect(this, SIGNAL(view2DEnabled(bool)), _view2D, SLOT(setVisible(bool)));
connect(this, SIGNAL(view3DEnabled(bool)), _view3D, SLOT(setVisible(bool)));
connect(this, SIGNAL(previewEnabled(bool)), _view2D, SLOT(enablePreview(bool)));
connect(this, SIGNAL(positionChanged(double, double, double, double)), _view2D, SLOT(setPosition(double, double, double, double)));
connect(this, SIGNAL(positionChanged(double, double, double, double)), _view3D, SLOT(setPosition(double, double, double, double)));
connect(this, SIGNAL(positionChanged(double, double, double, double)), preview, SLOT(setPreviewPosition(double, double, double, double)));
connect(this, SIGNAL(modeChangedMandelbrot()), _view2D, SLOT(setMandelbrotMode()));
connect(this, SIGNAL(modeChangedMandelbrot()), _view3D, SLOT(setMandelbrotMode()));
connect(this, SIGNAL(modeChangedJulia(double, double)), _view2D, SLOT(setJuliaMode(double, double)));
connect(this, SIGNAL(modeChangedJulia(double, double)), _view3D, SLOT(setJuliaMode(double, double)));
connect(this, SIGNAL(precisionChanged(double, double)), _view2D, SLOT(setQuality(double, double)));
connect(this, SIGNAL(precisionChanged(double, double)), _view3D, SLOT(setQuality(double, double)));
connect(this, SIGNAL(precisionChanged(double, double)), preview, SLOT(setQuality(double, double)));
connect(this, SIGNAL(backgroundChanged(QRgb)), _view2D, SLOT(setBackground(QRgb)));
connect(this, SIGNAL(backgroundChanged(QRgb)), _view3D, SLOT(setBackground(QRgb)));
connect(this, SIGNAL(backgroundChanged(QRgb)), preview, SLOT(setBackground(QRgb)));
connect(this, SIGNAL(gradientChanged(const QRgb*, double, double)), _view2D, SLOT(setGradient(const QRgb*, double, double)));
connect(this, SIGNAL(gradientChanged(const QRgb*, double, double)), _view3D, SLOT(setGradient(const QRgb*, double, double)));
connect(this, SIGNAL(gradientChanged(const QRgb*, double, double)), preview, SLOT(setGradient(const QRgb*, double, double)));
connect(_view2D, SIGNAL(previewVisible(bool)), preview, SLOT(setVisible(bool)));
connect(_view2D, SIGNAL(previewPosition(double, double)), preview, SLOT(setJuliaMode(double, double)));
connect(_view2D, SIGNAL(positionChanged(double, double, double, double)), this, SLOT(setPosition(double, double, double, double)));
connect(_view2D, SIGNAL(previewDoubleClick(double, double)), this, SLOT(setJuliaMode(double, double)));
connect(this, SIGNAL(gridSizeChanged(int, int)), _view3D, SLOT(setGridSize(int, int)));
connect(this, SIGNAL(heightScaleChanged(double)), _view3D, SLOT(setHeightScale(double)));
_view2D->enableTransform(true);
KStatusBar* status = statusBar();
status->setSizeGripEnabled(false);
QProgressBar* progress = new QProgressBar(100, status);
progress->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
progress->setMaximumHeight(status->sizeHint().height() - 2);
progress->setMinimumWidth(120);
progress->setProgress(100);
status->addWidget(progress, 0, true);
connect(_view2D, SIGNAL(updateProgress(int)), progress, SLOT(setProgress(int)));
connect(_view3D, SIGNAL(updateProgress(int)), progress, SLOT(setProgress(int)));
}