当前位置: 首页>>代码示例>>C++>>正文


C++ QDockWidget::toggleViewAction方法代码示例

本文整理汇总了C++中QDockWidget::toggleViewAction方法的典型用法代码示例。如果您正苦于以下问题:C++ QDockWidget::toggleViewAction方法的具体用法?C++ QDockWidget::toggleViewAction怎么用?C++ QDockWidget::toggleViewAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QDockWidget的用法示例。


在下文中一共展示了QDockWidget::toggleViewAction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: createDockWindows

void MainWindow::createDockWindows()
{
	// Engine debug
	QDockWidget* engineDebugDock = new QDockWidget(tr("Engine Debug"), this);
	m_engineDebugLog = new PlainTextLog(engineDebugDock);
	connect(m_engineDebugLog, SIGNAL(saveLogToFileRequest()), this,
		SLOT(saveLogToFile()));
	engineDebugDock->setWidget(m_engineDebugLog);

	addDockWidget(Qt::BottomDockWidgetArea, engineDebugDock);

	// Move list
	QDockWidget* moveListDock = new QDockWidget(tr("Moves"), this);
	moveListDock->setWidget(m_moveList);

	addDockWidget(Qt::RightDockWidgetArea, moveListDock);

	// Tags
	QDockWidget* tagsDock = new QDockWidget(tr("Tags"), this);
	QTreeView* tagsView = new QTreeView(tagsDock);
	tagsView->setModel(m_tagsModel);
	tagsView->setAlternatingRowColors(true);
	tagsView->setRootIsDecorated(false);
	tagsDock->setWidget(tagsView);

	addDockWidget(Qt::RightDockWidgetArea, tagsDock);

	tabifyDockWidget(moveListDock, tagsDock);
	moveListDock->raise();

	// Add toggle view actions to the View menu
	m_viewMenu->addAction(moveListDock->toggleViewAction());
	m_viewMenu->addAction(tagsDock->toggleViewAction());
	m_viewMenu->addAction(engineDebugDock->toggleViewAction());
}
开发者ID:thesmartwon,项目名称:OpenChess,代码行数:35,代码来源:mainwindow.cpp

示例2: createDockWidget

void FFCP::createDockWidget()
{
	//设置主窗体的第一个QDockWidget  
	QDockWidget *firstDockWidget = new QDockWidget(this);
	//设置第一个QDockWidget的窗口名称  
	firstDockWidget->setWindowTitle(tr("代码查看器"));
	//设置第一个QDockWidget的可停靠区域,全部可停靠  
	firstDockWidget->setAllowedAreas(Qt::AllDockWidgetAreas);
	//设置第一个QDockWidget内的控件并设置该控件的属性  
	codeViewer = new QTextEdit(tr("打开main.c文件"));  //前面别给定义 内存要报错 弄了我一天!!!!!!!!
	codeViewer->setAcceptDrops(false);  //禁止向codeViewer拖入东西
	firstDockWidget->setWidget(codeViewer);
	//向主窗体中添加第一个QDockWidget控件 第一个参数表示初始显示的位置 第二个参数是要添加的QDockWidget控件  
	this->addDockWidget(Qt::RightDockWidgetArea, firstDockWidget);
	//向菜单和工具栏中添加第一个QDockWidget的显示和隐藏动作  
	viewMenu->addAction(firstDockWidget->toggleViewAction());



	//设置第二个QDockWidget  
	QDockWidget *secondDockWidget = new QDockWidget(this);
	secondDockWidget->setWindowTitle(tr("功能编辑盒"));
	secondDockWidget->setAllowedAreas(Qt::AllDockWidgetAreas);
	functionBox = new FunctionBox;
	secondDockWidget->setWidget(functionBox);
	this->addDockWidget(Qt::LeftDockWidgetArea, secondDockWidget);
	//向菜单和工具栏中添加第一个QDockWidget的显示和隐藏动作  
	viewMenu->addAction(secondDockWidget->toggleViewAction());
}
开发者ID:sylzd,项目名称:FFCP,代码行数:29,代码来源:ffcp.cpp

示例3: addDockForWidget

/*!
    Keep track of dock widgets so they can be shown/hidden for different languages
*/
QDockWidget *DebuggerMainWindow::createDockWidget(const DebuggerLanguage &language,
    QWidget *widget)
{
    QDockWidget *dockWidget = addDockForWidget(widget);
    dockWidget->setObjectName(widget->objectName());
    addDockWidget(Qt::BottomDockWidgetArea, dockWidget);

    if (!(d->m_activeDebugLanguages & language))
        dockWidget->hide();

    QAction *toggleViewAction = dockWidget->toggleViewAction();
    Command *cmd = ActionManager::registerAction(toggleViewAction,
             Id("Debugger.").withSuffix(widget->objectName()));
    cmd->setAttribute(Command::CA_Hide);

    dockWidget->installEventFilter(&d->m_resizeEventFilter);

    connect(dockWidget->toggleViewAction(), &QAction::triggered,
            d, &DebuggerMainWindowPrivate::updateDockWidgetSettings);
    connect(dockWidget, &QDockWidget::topLevelChanged,
            d, &DebuggerMainWindowPrivate::updateDockWidgetSettings);
    connect(dockWidget, &QDockWidget::dockLocationChanged,
            d, &DebuggerMainWindowPrivate::updateDockWidgetSettings);

    return dockWidget;
}
开发者ID:KeeganRen,项目名称:qt-creator,代码行数:29,代码来源:debuggermainwindow.cpp

示例4: createDockWindows

void FenPrincipale::createDockWindows()
{
    QDockWidget *dockDonnee = new QDockWidget(tr("Données"), this);
    dockDonnee->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);

    addDockWidget(Qt::RightDockWidgetArea, dockDonnee);
   QSplitter *splitter = new QSplitter(dockDonnee);
   QSize size(800,800);
   splitter->setMinimumSize(size);
   splitter->addWidget(tablemesures);
   splitter->addWidget(tabless);
   splitter->setOrientation(Qt::Vertical);
   QList<int> list = QList<int>() << 800 << 800;

   splitter->setSizes(list);


    viewMenu->addAction(dockDonnee->toggleViewAction());

   QDockWidget *dockCalcul = new QDockWidget(tr("Calculs"), this);


    addDockWidget(Qt::RightDockWidgetArea, dockCalcul);
    viewMenu->addAction(dockCalcul->toggleViewAction());
   // QSplitter *splitter = new QSplitter(dockDonnee);

   //   splitter->addWidget(tabless);
    //  splitter->addWidget(tablemesures);
   //  QList<int> list = QList<int>() << 150 << 150;


//      splitter->setSizes(list);

  }
开发者ID:sepiropht,项目名称:caltopo,代码行数:34,代码来源:fenprincipale.cpp

示例5: createDockWindows

void MainWindow::createDockWindows()
{
    QDockWidget *dock = new QDockWidget(tr("History"), this);
    dock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
    historyList = new QListWidget(dock);
    dock->setWidget(historyList);
    addDockWidget(Qt::RightDockWidgetArea, dock);
    viewMenu->addAction(dock->toggleViewAction());

    dock = new QDockWidget(tr("Command Line"));
    dock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
    QStringList wordList;
    wordList << "FW"<<"BK"<<"CW"<<"CCW"<<"ROT"<<"BLOCK"<<"FOR"<<"RESET"<<"DOWN"<<"UP";
    QCompleter *completer = new QCompleter(wordList);
    completer->setCaseSensitivity(Qt::CaseInsensitive);
    cmdLineEdit = new QLineEdit();
    cmdLineEdit->setCompleter(completer);
    dock->setWidget(cmdLineEdit);
    addDockWidget(Qt::RightDockWidgetArea, dock);
    viewMenu->addAction(dock->toggleViewAction());
////////////////////////////////////////////////////////////////////////////////
    // ZAD 3
    cmdLineEdit->installEventFilter(keyPressEater);
    connect(cmdLineEdit, SIGNAL(returnPressed()), this, SLOT(sendCmd()));
    connect(keyPressEater, SIGNAL(odzyskaj()), this, SLOT(odzyskaj()));
}
开发者ID:delor,项目名称:turtle,代码行数:26,代码来源:mainwindow.cpp

示例6: connected

MonitorWindow::MonitorWindow():
   connected(false),
   usersSelectionCount(0),
   initialized(false )
{
   qServer = new afqt::QServer( this);
   qthreadClientUp = new afqt::QThreadClientUp( this, false, af::Environment::getMonitorUpdatePeriod(), af::Environment::getMonitorConnectRetries());
   qthreadClientSend = new afqt::QThreadClientSend( this);
   if( qServer->isInitialized() == false )
   {
      AFERROR("MonitorWindow::MonitorWindow: Server initialization failed.\n");
      return;
   }
   username = afqt::stoq( af::Environment::getUserName());
   hostname = afqt::stoq( af::Environment::getHostName());
   setWindowTitle("MonitorWindow::" + username + "@" + hostname + ":(connecting...)");


   QMenu * viewMenu = menuBar()->addMenu("View");


   QDockWidget * dock;

   dock = new QDockWidget( "Renders", this);
   rendersList = new ListRenders( dock);
   dock->setWidget( rendersList);
   addDockWidget( Qt::LeftDockWidgetArea, dock);
   viewMenu->addAction( dock->toggleViewAction());

   dock = new QDockWidget( "Users", this);
   usersList = new ListUsers( dock);
   dock->setWidget( usersList);
   addDockWidget( Qt::RightDockWidgetArea, dock);
   viewMenu->addAction( dock->toggleViewAction());

   dock = new QDockWidget( "Jobs", this);
   jobsList = new ListJobs( dock);
   dock->setWidget( jobsList);
   addDockWidget( Qt::RightDockWidgetArea, dock);
   viewMenu->addAction( dock->toggleViewAction());

   nodesList[ MTRenders ] = rendersList;
   nodesList[ MTUsers   ] = usersList;
   nodesList[ MTJobs    ] = jobsList;

   connect( usersList,         SIGNAL( itemSelectionChanged()), this, SLOT( usersSelectionChanged()));

   connect( qServer,           SIGNAL( newMsg( af::Msg*)), this, SLOT( caseMessage( af::Msg*)));
   connect( qthreadClientUp,   SIGNAL( newMsg( af::Msg*)), this, SLOT( caseMessage( af::Msg*)));
   connect( qthreadClientSend, SIGNAL( newMsg( af::Msg*)), this, SLOT( caseMessage( af::Msg*)));
   connect( qthreadClientUp,   SIGNAL( connectionLost() ), this, SLOT( connectionLost()));
   connect( qthreadClientSend, SIGNAL( connectionLost() ), this, SLOT( connectionLost()));
   monitor = new MonitorHost();
   initialized = true;
   monitor->stdOut();
   sendRegister();
}
开发者ID:Spudster3,项目名称:cgru,代码行数:57,代码来源:monitorwindow.cpp

示例7: setupPanelView

void View::setupPanelView(PanelView* v)
{
    using namespace std;
    QDockWidget* dial = new QDockWidget {v->defaultPanelStatus().prettyName, this};
    dial->setWidget(v->getWidget());
    dial->toggleViewAction()->setShortcut(v->shortcut());
    emit insertActionIntoMenubar({MenuInterface::name(ToplevelMenuElement::ViewMenu) + "/" +
                                  MenuInterface::name(ViewMenuElement::Windows),
                                  dial->toggleViewAction()});

    // Note : this only has meaning at initialisation time.
    auto dock = v->defaultPanelStatus().dock;

    this->addDockWidget(dock, dial);
    if(dock == Qt::LeftDockWidgetArea)
    {
        m_leftWidgets.push_back({v, dial});
        if(m_leftWidgets.size() > 1)
        {
            // Find the one with the biggest priority
            auto it = max_element(begin(m_leftWidgets),
                                  end(m_leftWidgets),
                                  [] (const auto& lhs, const auto& rhs)
            { return lhs.first->defaultPanelStatus().priority < rhs.first->defaultPanelStatus().priority; });

            it->second->raise();
            if(dial != it->second)
            {
                tabifyDockWidget(dial, it->second);
            }
        }
    }
    else if(dock == Qt::RightDockWidgetArea)
    {
        m_rightWidgets.push_back({v, dial});

        if(m_rightWidgets.size() > 1)
        {
            // Find the one with the biggest priority
            auto it = max_element(begin(m_rightWidgets),
                                  end(m_rightWidgets),
                                  [] (const auto& lhs, const auto& rhs)
            { return lhs.first->defaultPanelStatus().priority < rhs.first->defaultPanelStatus().priority; });

            it->second->raise();
            if(dial != it->second)
            {
                tabifyDockWidget(dial, it->second);
            }
        }
    }

    if(!v->defaultPanelStatus().shown)
        dial->hide();
}
开发者ID:Sciss,项目名称:i-score,代码行数:55,代码来源:View.cpp

示例8: createDockWindows

void MainWindow::createDockWindows()
{
    QDockWidget *dock = new QDockWidget(tr("Text Editor"), this);
    m_editor = new TextEdit(dock);
    connect(m_editor->document(), SIGNAL(contentsChanged()), this, SLOT(onEditorChanged()));
    dock->setWidget(m_editor);
    dock->setObjectName("text_editor");
    addDockWidget(Qt::RightDockWidgetArea, dock);

    m_showEditorDockAction = dock->toggleViewAction();
    m_showEditorDockAction->setIconVisibleInMenu(false);
    m_showEditorDockAction->setStatusTip(tr("Show or hide the document editor dock"));
    m_showEditorDockAction->setIcon(QIcon::fromTheme("accessories-text-editor"));
    m_showEditorDockAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_0));

    dock = new QDockWidget(tr("Assistant"), this);
    m_assistantToolBox = new QToolBox(dock);
    dock->setWidget(m_assistantToolBox);
    dock->setObjectName("assistant");
    addDockWidget(Qt::LeftDockWidgetArea, dock);
    connect(m_assistantToolBox, SIGNAL(currentChanged(int)),
            this, SLOT(onCurrentAssistantChanged(int)));

    m_showAssistantDockAction = dock->toggleViewAction();
    m_showAssistantDockAction->setIconVisibleInMenu(false);
    m_showAssistantDockAction->setStatusTip(tr("Show or hide the assistant dock"));
#if !defined(Q_WS_WIN) // BUG: icons are not displayed when cross-linking
    m_showAssistantDockAction->setIcon(QIcon(":/assistant.svg"));
#endif
    m_showAssistantDockAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_1));

    dock = new QDockWidget(tr("Assistant Info"), this);
    QWidget* widget = new QWidget(dock);
    m_assistantPreviewNotes = new QLabel(widget);
    m_assistantPreviewNotes->setText(tr("Code:"));
    m_assistantCodePreview = new QTextEdit(widget);
    m_assistantCodePreview->setReadOnly(true);
    QBoxLayout* assistant_info_layout = new QBoxLayout(QBoxLayout::TopToBottom, widget);
    assistant_info_layout->addWidget(m_assistantPreviewNotes);
    assistant_info_layout->addWidget(m_assistantCodePreview);
    widget->setLayout(assistant_info_layout);
    dock->setWidget(widget);
    dock->setObjectName("assistant_info");
    addDockWidget(Qt::LeftDockWidgetArea, dock);

    m_showAssistantInfoDockAction = dock->toggleViewAction();
    m_showAssistantInfoDockAction->setIconVisibleInMenu(false);
    m_showAssistantInfoDockAction->setStatusTip(tr("Show or hide the assistant info dock"));
#if !defined(Q_WS_WIN) // BUG: icons are not displayed when cross-linking
    m_showAssistantInfoDockAction->setIcon(QIcon(":/assistant-info.svg"));
#endif
    m_showAssistantInfoDockAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_2));
}
开发者ID:JoyIfBam5,项目名称:plantumlqeditor,代码行数:53,代码来源:mainwindow.cpp

示例9: setLocked

void KoDockWidgetTitleBar::setLocked(bool locked)
{
    QDockWidget *q = qobject_cast<QDockWidget*>(parentWidget());

    d->locked = locked;
    d->lockButton->blockSignals(true);
    d->lockButton->setChecked(locked);
    d->lockButton->blockSignals(false);

    //qDebug() << "setlocked" << q << d->locked << locked;

    if (locked) {
        d->features = q->features();
        q->setFeatures(QDockWidget::NoDockWidgetFeatures);
    }
    else {
        q->setFeatures(d->features);
    }

    q->toggleViewAction()->setEnabled(!locked);
    d->closeButton->setEnabled(!locked);
    d->floatButton->setEnabled(!locked);
    d->collapseButton->setEnabled(!locked);

    d->updateIcons();
    q->setProperty("Locked", locked);
    resizeEvent(0);
}
开发者ID:ChrisJong,项目名称:krita,代码行数:28,代码来源:KoDockWidgetTitleBar.cpp

示例10: QMainWindow

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    this->setWindowIcon(QIcon(":res/123.png"));
    mdi = new QMdiArea(this);
    this->setCentralWidget(mdi);
    QDockWidget* dock = new QDockWidget(tr("Script log"),this);
    dock->setObjectName(tr("ScriptLogDock"));
    logText = new QTextEdit(dock);
    logText->setReadOnly(true);
    logText->setLineWrapMode(QTextEdit::NoWrap);
    dock->setWidget(logText);
    this->addDockWidget(Qt::BottomDockWidgetArea, dock);

    run_script_init(this);

    // make sure the about menu is shown
    QMenu* menu = 0;
    QList<QAction*> list = menuBar()->actions();
    foreach(QAction* act, list){
        if( act->text().contains(tr("help"),Qt::CaseInsensitive) ){
            menu = act->menu();
        }
    }

    if(menu == 0){
        menu = menuBar()->addMenu(tr("&Help"));
    }
    menu->addAction(dock->toggleViewAction());
    menu->addSeparator();
    QAction* act = menu->addAction(tr("&About..."));
    connect(act,SIGNAL(triggered()),this,SLOT(my_about()));
    this->setWindowTitle(tr("X Toolbox (Beta)"));
}
开发者ID:Jacob1988,项目名称:lxyppc-serial,代码行数:34,代码来源:mainwindow.cpp

示例11: setupDocks

void KkrEditMain::setupDocks()
{
    QDockWidget *pDockMetaData = new QDockWidget{tr("Problem Info"), this};
    pDockMetaData->setWidget(m_pMetaView);
    pDockMetaData->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
    m_pMenuView->addAction(pDockMetaData->toggleViewAction());
    addDockWidget(Qt::LeftDockWidgetArea, pDockMetaData);
}
开发者ID:hideki1234,项目名称:Kakuro,代码行数:8,代码来源:kkreditmain.cpp

示例12: createDockWindows

//! [9]
void MainWindow::createDockWindows()
{
    QDockWidget *dock = new QDockWidget(tr("Customers"), this);
    dock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
    customerList = new QListWidget(dock);
    customerList->addItems(QStringList()
            << "John Doe, Harmony Enterprises, 12 Lakeside, Ambleton"
            << "Jane Doe, Memorabilia, 23 Watersedge, Beaton"
            << "Tammy Shea, Tiblanka, 38 Sea Views, Carlton"
            << "Tim Sheen, Caraba Gifts, 48 Ocean Way, Deal"
            << "Sol Harvey, Chicos Coffee, 53 New Springs, Eccleston"
            << "Sally Hobart, Tiroli Tea, 67 Long River, Fedula");
    dock->setWidget(customerList);
    addDockWidget(Qt::RightDockWidgetArea, dock);
    viewMenu->addAction(dock->toggleViewAction());

    dock = new QDockWidget(tr("Paragraphs"), this);
    paragraphsList = new QListWidget(dock);
    paragraphsList->addItems(QStringList()
            << "Thank you for your payment which we have received today."
            << "Your order has been dispatched and should be with you "
               "within 28 days."
            << "We have dispatched those items that were in stock. The "
               "rest of your order will be dispatched once all the "
               "remaining items have arrived at our warehouse. No "
               "additional shipping charges will be made."
            << "You made a small overpayment (less than $5) which we "
               "will keep on account for you, or return at your request."
            << "You made a small underpayment (less than $1), but we have "
               "sent your order anyway. We'll add this underpayment to "
               "your next bill."
            << "Unfortunately you did not send enough money. Please remit "
               "an additional $. Your order will be dispatched as soon as "
               "the complete amount has been received."
            << "You made an overpayment (more than $5). Do you wish to "
               "buy more items, or should we return the excess to you?");
    dock->setWidget(paragraphsList);
    addDockWidget(Qt::RightDockWidgetArea, dock);
    viewMenu->addAction(dock->toggleViewAction());

    connect(customerList, &QListWidget::currentTextChanged,
            this, &MainWindow::insertCustomer);
    connect(paragraphsList, &QListWidget::currentTextChanged,
            this, &MainWindow::addParagraph);
}
开发者ID:2gis,项目名称:2gisqt5android,代码行数:46,代码来源:mainwindow.cpp

示例13: createMainWindowDock

QDockWidget* PluginAPI::createMainWindowDock(Qt::DockWidgetArea dockWidgetArea, const QString& title)
{
	QDockWidget* dock = new QDockWidget(title, m_mainWindow);
	dock->setAllowedAreas(Qt::AllDockWidgetAreas);
	dock->setAttribute(Qt::WA_DeleteOnClose);
	m_mainWindow->addDockWidget(dockWidgetArea, dock);
	m_mainWindow->addViewAction(dock->toggleViewAction());
	return dock;
}
开发者ID:0x7678,项目名称:rtl-sdrangelove,代码行数:9,代码来源:pluginapi.cpp

示例14: createDockWindows

void DesktopMainWindow::createDockWindows()
{
	QDockWidget *catalogDock = new QDockWidget(tr("Base Map"), this);
  catalogDock->setObjectName(tr("CATALOG_DOCK_WINDOW"));
  catalogDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
	MapLayerCatalogWidget* layerCatalog = new MapLayerCatalogWidget(_app);
	catalogDock->setWidget(layerCatalog);
	addDockWidget(Qt::LeftDockWidgetArea, catalogDock);
  _viewMenu->insertAction(_viewSeparator, catalogDock->toggleViewAction());

	QDockWidget *serverDock = new QDockWidget(tr("User Data"), this);
  serverDock->setObjectName(tr("SERVER_DOCK_WINDOW"));
  serverDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
	_serverManager = new ServerManagementWidget(_app);
	serverDock->setWidget(_serverManager);
	addDockWidget(Qt::LeftDockWidgetArea, serverDock);
	_viewMenu->insertAction(_viewSeparator, serverDock->toggleViewAction());
}
开发者ID:KrisLee,项目名称:godzi-desktop,代码行数:18,代码来源:DesktopMainWindow.cpp

示例15: showTileScale

void QgsTileScaleWidget::showTileScale( QMainWindow *mainWindow )
{
  QDockWidget *dock = mainWindow->findChild<QDockWidget *>( "theTileScaleDock" );
  if ( dock )
  {
    dock->setVisible( dock->isHidden() );
    return;
  }

  QgsMapCanvas *canvas = mainWindow->findChild<QgsMapCanvas *>( "theMapCanvas" );
  QgsDebugMsg( QString( "canvas:%1 [%2]" ).arg(( ulong ) canvas, 0, 16 ).arg( canvas ? canvas->objectName() : "" ) );
  if ( !canvas )
  {
    QgsDebugMsg( "map canvas theMapCanvas not found" );
    return;
  }

  QgsTileScaleWidget *tws = new QgsTileScaleWidget( canvas );
  tws->setObjectName( "theTileScaleWidget" );

  QObject *legend = mainWindow->findChild<QObject*>( "theLayerTreeView" );
  if ( legend )
  {
    connect( legend, SIGNAL( currentLayerChanged( QgsMapLayer* ) ),
             tws, SLOT( layerChanged( QgsMapLayer* ) ) );
  }
  else
  {
    QgsDebugMsg( "legend not found" );
  }

  //create the dock widget
  dock = new QDockWidget( tr( "Tile Scale Panel" ), mainWindow );
  dock->setObjectName( "theTileScaleDock" );
  dock->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
  mainWindow->addDockWidget( Qt::RightDockWidgetArea, dock );

  // add to the Panel submenu
  QMenu *panelMenu = mainWindow->findChild<QMenu *>( "mPanelMenu" );
  if ( panelMenu )
  {
    // add to the Panel submenu
    panelMenu->addAction( dock->toggleViewAction() );
  }
  else
  {
    QgsDebugMsg( "panel menu not found" );
  }

  dock->setWidget( tws );

  connect( dock, SIGNAL( visibilityChanged( bool ) ), tws, SLOT( scaleEnabled( bool ) ) );

  QSettings settings;
  dock->setVisible( settings.value( "/UI/tileScaleEnabled", false ).toBool() );
}
开发者ID:stevenmizuno,项目名称:QGIS,代码行数:56,代码来源:qgstilescalewidget.cpp


注:本文中的QDockWidget::toggleViewAction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。