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


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

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


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

示例1: attach

bool FrameAttachmentPoint::attach(AttachableFrame* frame)
{
    QLayout* layout;
    QWidget* attWidget;
    QFrame* attFrame;
    QDockWidget* attDockWidget;
    QTabWidget* attTabWidget;
    QMainWindow* attMainWindow;
    int index = 0;

    if ((int)mAttachedFrames.size() >= mMaxAttachmentCount)
    {
        LOG_ERROR() << "FrameAttachmentPoint::attach(): cannot attach more than " << mMaxAttachmentCount <<
                       " Frame" << (mMaxAttachmentCount > 1 ? "s" : "") << " to Attachment Point " << mName << ".";
       return false;
    }

    //Attach the frame in a way depending on its type
    switch (mType)
    {
    case ATTACHMENT_NONE:
         LOG_ERROR() << "FrameAttachmentPoint::attach(): cannot attach to illegal Attachment Point.";
         return false;
        break;
    case ATTACHMENT_WIDGET:
        //Attach to Widget with adding a new layout
        layout = WindowManager::createNeutralLayout();
        layout->addWidget(&*frame);
        frame->show();
        attWidget = (dynamic_cast<QWidget*>(mAttachmentPoint));
        attWidget->setLayout(layout);
        attWidget->show();
        break;
    case ATTACHMENT_FRAME:
        //Attach to Frame with adding a new layout
        layout = WindowManager::createNeutralLayout();
        layout->addWidget(&*frame);
        frame->show();
        attFrame = (dynamic_cast<QFrame*>(mAttachmentPoint));
        attFrame->setLayout(layout);
        attFrame->show();
        break;
    case ATTACHMENT_TABWIDGET:
        //Attach to TabWidget with adding a new page and (automatically) a layout
        attTabWidget = (dynamic_cast<QTabWidget*>(mAttachmentPoint));
        index = attTabWidget->addTab(&*frame, frame->getCaption());
        WindowManager::changeToNeutralLayout(attTabWidget->widget(index)->layout());
        break;
    case ATTACHMENT_DOCKWIDGET:
        //Attach to DockWidget with adding a new layout
        layout = WindowManager::createNeutralLayout();
        layout->addWidget(&*frame);
        frame->show();
        attDockWidget = (dynamic_cast<QDockWidget*>(mAttachmentPoint));
        attDockWidget->setLayout(layout);
        attDockWidget->show();
        break;
    case ATTACHMENT_MAINWINDOW:
        //Attach to MainWindow with adding a new layout
        layout = WindowManager::createNeutralLayout();
        layout->addWidget(&*frame);
        frame->show();
        attMainWindow = (dynamic_cast<QMainWindow*>(mAttachmentPoint));
        attMainWindow->setLayout(layout);
        attMainWindow->show();
        break;
    default:
         LOG_ERROR() << "FrameAttachmentPoint::attach(): unknown Attachment Point.";
        return false;
        break;
    }

    //Store the attachment pointer
    mAttachedFrames.insert(frame->getPluginId(), frame);

    return true;
}
开发者ID:MadMaxPavlo,项目名称:SimSpark-SPL,代码行数:77,代码来源:frameattachmentpoint.cpp

示例2: setupDockWindow

void CLogisticMainWindow::setupDockWindow(const bool &visible)
{
    if (!visible) return;

    QDockWidget *dockDictionary = new QDockWidget(tr("Справочники"));
                 dockDictionary->setFeatures(QDockWidget::NoDockWidgetFeatures);

    QFrame *frameDictionary = new QFrame(this);

    QCommandLinkButton *client = new QCommandLinkButton(tr("Заказчики"), tr("Справочник клиентов"), frameDictionary);
                        client->setIcon(QIcon("data/picture/sidebar/customer.ico"));
    connect(client, SIGNAL(clicked()), this, SLOT(slotCustomerDictionary()));

    QCommandLinkButton *supplier = new QCommandLinkButton(tr("Поставщики"), tr("Справочник поставщиков"), frameDictionary);
                        supplier->setIcon(QIcon("data/picture/sidebar/suppliers.ico"));
    connect(supplier, SIGNAL(clicked()), this, SLOT(slotSuppliersDictionary()));

    QCommandLinkButton *producer = new QCommandLinkButton(tr("Производители"), tr("Справочник производителей"), frameDictionary);
                        producer->setIcon(QIcon("data/picture/sidebar/producers.ico"));
    connect(producer, SIGNAL(clicked()), this, SLOT(slotProdusersDictionary()));

    QCommandLinkButton *contact = new QCommandLinkButton(tr("Контакты"), tr("Справочник контактов"), frameDictionary);
                        contact->setIcon(QIcon("data/picture/sidebar/contacts.ico"));
    connect(contact, SIGNAL(clicked()), this, SLOT(slotContactsDictionary()));

    QCommandLinkButton *position = new QCommandLinkButton (tr("Должности"), tr("Справочник должностей"), frameDictionary);
                        position->setIcon(QIcon("data/picture/sidebar/positions.ico"));
    connect(position, SIGNAL(clicked()), this, SLOT(slotPositionsDictionary()));

    QCommandLinkButton *tasktype = new QCommandLinkButton (tr("Типы задач"), tr("Справочник типов задач"), frameDictionary);
                        tasktype->setIcon(QIcon("data/picture/sidebar/tasktype.ico"));
    connect(tasktype, SIGNAL(clicked()), this, SLOT(slotTaskTypesDictionary()));

    QCommandLinkButton *contractor = new QCommandLinkButton(tr("Контрагенты"), tr("Справочник контрагентов"), frameDictionary);
                        contractor->setIcon(QIcon("data/picture/sidebar/contractortype.ico"));
    connect(contractor, SIGNAL(clicked()), this, SLOT(slotContractorTypesDictionary()));

    QCommandLinkButton *status = new QCommandLinkButton (tr("Статусы"), tr("Справочник статусов"), frameDictionary);
                        status->setIcon(QIcon("data/picture/sidebar/status.ico"));
    connect(status, SIGNAL(clicked()), this, SLOT(slotStatusDictionary()));

    QCommandLinkButton *priority = new QCommandLinkButton (tr("Приоритеты"), tr("Справочник приоритетов"), frameDictionary);
                        priority->setIcon(QIcon("data/picture/sidebar/priority.ico"));
    connect(priority, SIGNAL(clicked()), this, SLOT(slotPrioritiesDictionary()));

    QCommandLinkButton *countrycity = new QCommandLinkButton (tr("Страны и города"), tr("Справочник стран и городов"), frameDictionary);
                        countrycity->setIcon(QIcon("data/picture/sidebar/countryandcity.ico"));
    connect(countrycity, SIGNAL(clicked()), this, SLOT(slotCountryCityDictionary()));

    QVBoxLayout *vboxDictionary = new QVBoxLayout(frameDictionary);
                 vboxDictionary->setSizeConstraint(QVBoxLayout::SetMinAndMaxSize);
                 vboxDictionary->addWidget(client);
                 vboxDictionary->addWidget(supplier);
                 vboxDictionary->addWidget(producer);
                 vboxDictionary->addWidget(contact);
                 vboxDictionary->addWidget(position);
                 vboxDictionary->addWidget(tasktype);
                 vboxDictionary->addWidget(contractor);
                 vboxDictionary->addWidget(status);
                 vboxDictionary->addWidget(priority);
                 vboxDictionary->addWidget(countrycity);

    dockDictionary->setLayout(vboxDictionary);
    dockDictionary->setWidget(frameDictionary);

    QDockWidget *dockFolder = new QDockWidget(tr("Папки"));
                 dockFolder->setFeatures(QDockWidget::NoDockWidgetFeatures);

    QFrame *frameFolder = new QFrame(this);

    QCommandLinkButton *relation = new QCommandLinkButton(tr("Взаимоотношения"), frameFolder);
                        relation->setIcon(QIcon("data/picture/sidebar/relations.ico"));
    connect(relation, SIGNAL(clicked()), this, SLOT(slotRelationsFolder()));

    QCommandLinkButton *calendar = new QCommandLinkButton (tr("Календарь"), frameFolder);
                        calendar->setIcon(QIcon("data/picture/sidebar/calendar.ico"));
    connect(calendar, SIGNAL(clicked()), this, SLOT(slotCalendarFolder()));

    QCommandLinkButton *reminder = new QCommandLinkButton (tr("Напоминания"), frameFolder);
                        reminder->setIcon(QIcon("data/picture/sidebar/reminder.ico"));
    connect(reminder, SIGNAL(clicked()), this, SLOT(slotReminderFolder()));

    QVBoxLayout *vboxFolder = new QVBoxLayout(frameFolder);
                 vboxFolder->setSizeConstraint(QVBoxLayout::SetMinAndMaxSize);
                 vboxFolder->addWidget(relation);
                 vboxFolder->addWidget(calendar);
                 vboxFolder->addWidget(reminder);

    dockFolder->setLayout(vboxFolder);
    dockFolder->setWidget(frameFolder);

    QDockWidget *dockAdditionally = new QDockWidget(tr("Дополнительно"));
                 dockAdditionally->setFeatures(QDockWidget::NoDockWidgetFeatures);

    QFrame *frameAdditionally = new QFrame(this);

    QCommandLinkButton *accounting = new QCommandLinkButton(tr("Учетные операции"), tr("Справочник УО"), frameAdditionally);
                        accounting->setIcon(QIcon("data/picture/sidebar/accounting.png"));
    connect(accounting, SIGNAL(clicked()), this, SLOT(slotAccountingAdditionally()));

//.........这里部分代码省略.........
开发者ID:dekalo64,项目名称:RLine,代码行数:101,代码来源:core_logisticmainwindow.cpp


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