/*! \reimp */ QString QAccessibleWidget::text(Text t, int child) const { QString str; switch (t) { case Name: if (!d->name.isEmpty()) { str = d->name; } else if (!widget()->accessibleName().isEmpty()) { str = widget()->accessibleName(); } else if (!child && widget()->isWindow()) { if (widget()->isMinimized()) str = qt_setWindowTitle_helperHelper(widget()->windowIconText(), widget()); else str = qt_setWindowTitle_helperHelper(widget()->windowTitle(), widget()); } else { str = qt_accStripAmp(buddyString(widget())); } break; case Description: if (!d->description.isEmpty()) str = d->description; else if (!widget()->accessibleDescription().isEmpty()) str = widget()->accessibleDescription(); #ifndef QT_NO_TOOLTIP else str = widget()->toolTip(); #endif break; case Help: if (!d->help.isEmpty()) str = d->help; #ifndef QT_NO_WHATSTHIS else str = widget()->whatsThis(); #endif break; case Accelerator: if (!d->accelerator.isEmpty()) str = d->accelerator; else str = qt_accHotKey(buddyString(widget())); break; case Value: str = d->value; break; default: break; } return str; }
void QDockWidgetPrivate::init() { Q_Q(QDockWidget); QDockWidgetLayout *layout = new QDockWidgetLayout(q); layout->setSizeConstraint(QLayout::SetMinAndMaxSize); QAbstractButton *button = new QDockWidgetTitleButton(q); button->setObjectName(QLatin1String("qt_dockwidget_floatbutton")); QObject::connect(button, SIGNAL(clicked()), q, SLOT(_q_toggleTopLevel())); layout->setWidgetForRole(QDockWidgetLayout::FloatButton, button); button = new QDockWidgetTitleButton(q); button->setObjectName(QLatin1String("qt_dockwidget_closebutton")); QObject::connect(button, SIGNAL(clicked()), q, SLOT(close())); layout->setWidgetForRole(QDockWidgetLayout::CloseButton, button); resizer = new QWidgetResizeHandler(q); resizer->setMovingEnabled(false); resizer->setActive(false); #ifndef QT_NO_ACTION toggleViewAction = new QAction(q); toggleViewAction->setCheckable(true); fixedWindowTitle = qt_setWindowTitle_helperHelper(q->windowTitle(), q); toggleViewAction->setText(fixedWindowTitle); QObject::connect(toggleViewAction, SIGNAL(triggered(bool)), q, SLOT(_q_toggleView(bool))); #endif updateButtons(); }
/*! \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); }
/*! \reimp */ QString QAccessibleWidget::text(QAccessible::Text t) const { QString str; switch (t) { case QAccessible::Name: if (!d->name.isEmpty()) { str = d->name; } else if (!widget()->accessibleName().isEmpty()) { str = widget()->accessibleName(); } else if (widget()->isWindow()) { if (widget()->isMinimized()) str = qt_setWindowTitle_helperHelper(widget()->windowIconText(), widget()); else str = qt_setWindowTitle_helperHelper(widget()->windowTitle(), widget()); } else { str = qt_accStripAmp(buddyString(widget())); } break; case QAccessible::Description: str = widget()->accessibleDescription(); #ifndef QT_NO_TOOLTIP if (str.isEmpty()) str = widget()->toolTip(); #endif break; case QAccessible::Help: #ifndef QT_NO_WHATSTHIS str = widget()->whatsThis(); #endif break; case QAccessible::Accelerator: str = qt_accHotKey(buddyString(widget())); break; case QAccessible::Value: break; default: break; } return str; }
/*! \internal */ QString QDecorationDefault::windowTitleFor(const QWidget *widget) const { return qt_setWindowTitle_helperHelper(widget->windowTitle(), widget); }