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


C++ QDockWidgetLayout::titleArea方法代码示例

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


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

示例1: changeEvent

/*! \reimp */
void QDockWidget::changeEvent(QEvent *event)
{
    Q_D(QDockWidget);
    QDockWidgetLayout *layout = qobject_cast<QDockWidgetLayout*>(this->layout());

    switch (event->type()) {
    case QEvent::ModifiedChange:
    case QEvent::WindowTitleChange:
        update(layout->titleArea());
#ifndef QT_NO_ACTION
        d->fixedWindowTitle = qt_setWindowTitle_helperHelper(windowTitle(), this);
        d->toggleViewAction->setText(d->fixedWindowTitle);
#endif
#ifndef QT_NO_TABBAR
        {
            QMainWindow *win = qobject_cast<QMainWindow*>(parentWidget());
            if (QMainWindowLayout *winLayout = qt_mainwindow_layout(win)) {
                if (QDockAreaLayoutInfo *info = winLayout->layoutState.dockAreaLayout.info(this))
                    info->updateTabBar();
            }
        }
#endif // QT_NO_TABBAR
        break;
    default:
        break;
    }
    QWidget::changeEvent(event);
}
开发者ID:phen89,项目名称:rtqt,代码行数:29,代码来源:qdockwidget.cpp

示例2: mousePressEvent

bool QDockWidgetPrivate::mousePressEvent(QMouseEvent *event)
{
#if !defined(QT_NO_MAINWINDOW)
    Q_Q(QDockWidget);

    QDockWidgetLayout *dwLayout
        = qobject_cast<QDockWidgetLayout*>(layout);

    if (!dwLayout->nativeWindowDeco()) {
        QRect titleArea = dwLayout->titleArea();

        if (event->button() != Qt::LeftButton ||
            !titleArea.contains(event->pos()) ||
            // check if the tool window is movable... do nothing if it
            // is not (but allow moving if the window is floating)
            (!hasFeature(this, QDockWidget::DockWidgetMovable) && !q->isFloating()) ||
            qobject_cast<QMainWindow*>(parent) == 0 ||
            isAnimating() || state != 0) {
            return false;
        }

        initDrag(event->pos(), false);

        if (state)
            state->ctrlDrag = hasFeature(this, QDockWidget::DockWidgetFloatable) && event->modifiers() & Qt::ControlModifier;

        return true;
    }

#endif // !defined(QT_NO_MAINWINDOW)
    return false;
}
开发者ID:phen89,项目名称:rtqt,代码行数:32,代码来源:qdockwidget.cpp

示例3: initDrag

void QDockWidgetPrivate::initDrag(const QPoint &pos, bool nca)
{
    if (state != 0)
        return;

    Q_Q(QDockWidget);
    QMainWindow *win = qobject_cast<QMainWindow*>(parent);
    Q_ASSERT(win != 0);
    QMainWindowLayout *layout = qt_mainwindow_layout(win);
    Q_ASSERT(layout != 0);
    if (layout->pluggingWidget != 0) // the main window is animating a docking operation
        return;

    state = new QDockWidgetPrivate::DragState;
    state->dragging = false;
    state->widgetItem = 0;
    state->ownWidgetItem = false;
    state->nca = nca;
    state->ctrlDrag = false;

    if (!q->isFloating()) {
        // When dragging the widget out of the docking area,
        // use the middle of title area as pressPos
        QDockWidgetLayout *dwlayout = qobject_cast<QDockWidgetLayout*>(q->layout());
        Q_ASSERT(dwlayout != 0);
        int width = undockedGeometry.isNull() ? q->width() : undockedGeometry.width();
        state->pressPos.setY(dwlayout->titleArea().height() / 2);
        state->pressPos.setX(width / 2);
    } else {
        state->pressPos = pos;
    }
}
开发者ID:fluxer,项目名称:katie,代码行数:32,代码来源:qdockwidget.cpp

示例4: mouseDoubleClickEvent

bool QDockWidgetPrivate::mouseDoubleClickEvent(QMouseEvent *event)
{
    QDockWidgetLayout *dwLayout = qobject_cast<QDockWidgetLayout*>(layout);

    if (!dwLayout->nativeWindowDeco()) {
        QRect titleArea = dwLayout->titleArea();

        if (event->button() == Qt::LeftButton && titleArea.contains(event->pos()) &&
            hasFeature(this, QDockWidget::DockWidgetFloatable)) {
            _q_toggleTopLevel();
            return true;
        }
    }
    return false;
}
开发者ID:phen89,项目名称:rtqt,代码行数:15,代码来源:qdockwidget.cpp

示例5: mouseDoubleClickEvent

void QDockWidgetPrivate::mouseDoubleClickEvent(QMouseEvent *event)
{
    Q_Q(QDockWidget);

    QDockWidgetLayout *layout = qobject_cast<QDockWidgetLayout*>(q->layout());

    if (!layout->nativeWindowDeco()) {
        QRect titleArea = layout->titleArea();

        if (event->button() != Qt::LeftButton)
            return;
        if (!titleArea.contains(event->pos()))
            return;
        if (!::hasFeature(q, QDockWidget::DockWidgetFloatable))
            return;
        _q_toggleTopLevel();
    }
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:18,代码来源:qdockwidget.cpp

示例6: setFloating

/*!
    \property QDockWidget::floating
    \brief whether the dock widget is floating

    A floating dock widget is presented to the user as an independent
    window "on top" of its parent QMainWindow, instead of being
    docked in the QMainWindow.

    \sa isWindow()
*/
void QDockWidget::setFloating(bool floating)
{
    Q_D(QDockWidget);

    // the initial click of a double-click may have started a drag...
    if (d->state != 0)
        d->endDrag(true);

    QRect r = d->undockedGeometry;

    if (floating && r.isNull()) {
        QDockWidgetLayout *layout = qobject_cast<QDockWidgetLayout*>(this->layout());
        QRect titleArea = layout->titleArea();
        int h = layout->verticalTitleBar ? titleArea.width() : titleArea.height();
        QPoint p = mapToGlobal(QPoint(h, h));
        r = QRect(p, size());
    }

    d->setWindowState(floating, false, floating ? r : QRect());
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:30,代码来源:qdockwidget.cpp

示例7: initStyleOption

/*!
    Initialize \a option with the values from this QDockWidget. This method
    is useful for subclasses when they need a QStyleOptionDockWidget, but don't want
    to fill in all the information themselves.

    \sa QStyleOption::initFrom()
*/
void QDockWidget::initStyleOption(QStyleOptionDockWidget *option) const
{
    Q_D(const QDockWidget);

    if (!option)
        return;
    QDockWidgetLayout *dwlayout = qobject_cast<QDockWidgetLayout*>(layout());

    option->initFrom(this);
    option->rect = dwlayout->titleArea();
    option->title = d->fixedWindowTitle;
    option->closable = hasFeature(this, QDockWidget::DockWidgetClosable);
    option->movable = hasFeature(this, QDockWidget::DockWidgetMovable);
    option->floatable = hasFeature(this, QDockWidget::DockWidgetFloatable);

    QDockWidgetLayout *l = qobject_cast<QDockWidgetLayout*>(layout());
    QStyleOptionDockWidgetV2 *v2
        = qstyleoption_cast<QStyleOptionDockWidgetV2*>(option);
    if (v2 != 0)
        v2->verticalTitleBar = l->verticalTitleBar;
}
开发者ID:phen89,项目名称:rtqt,代码行数:28,代码来源:qdockwidget.cpp

示例8: mousePressEvent

void QDockWidgetPrivate::mousePressEvent(QMouseEvent *event)
{
#if !defined(QT_NO_MAINWINDOW)
    Q_Q(QDockWidget);

    QDockWidgetLayout *layout
        = qobject_cast<QDockWidgetLayout*>(q->layout());

    if (!layout->nativeWindowDeco()) {
        QRect titleArea = layout->titleArea();

        if (event->button() != Qt::LeftButton)
            return;
        if (!titleArea.contains(event->pos()))
            return;
        // check if the tool window is movable... do nothing if it is not
        if (!::hasFeature(q, QDockWidget::DockWidgetMovable))
            return;

        if (qobject_cast<QMainWindow*>(q->parentWidget()) == 0)
            return;

        if (isAnimating())
            return;

        if (state != 0)
            return;

        initDrag(event->pos(), false);

        if (state == 0)
            return;

        state->ctrlDrag = event->modifiers() & Qt::ControlModifier;
    }

#endif // !defined(QT_NO_MAINWINDOW)
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:38,代码来源:qdockwidget.cpp


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