本文整理汇总了C++中KDockWidget::setWidget方法的典型用法代码示例。如果您正苦于以下问题:C++ KDockWidget::setWidget方法的具体用法?C++ KDockWidget::setWidget怎么用?C++ KDockWidget::setWidget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KDockWidget
的用法示例。
在下文中一共展示了KDockWidget::setWidget方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: initMainWindow
/**
* 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();
}
示例3: QToolButton
//.........这里部分代码省略.........
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 );
ColumnLabel->hide();
示例4: createWidgets
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)));
}