mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 02:42:55 +00:00
drop unused style hints
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
9d5183127c
commit
6ff87ca550
5 changed files with 28 additions and 103 deletions
|
@ -1756,9 +1756,6 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
|
||||||
QStyleHintReturnVariant return value. The QTextFormat::OutlinePen property is used for the outline and QTextFormat::BackgroundBrush
|
QStyleHintReturnVariant return value. The QTextFormat::OutlinePen property is used for the outline and QTextFormat::BackgroundBrush
|
||||||
for the background of the highlighted area.
|
for the background of the highlighted area.
|
||||||
|
|
||||||
\value SH_Menu_FlashTriggeredItem Flash triggered item.
|
|
||||||
\value SH_Menu_FadeOutOnHide Fade out the menu instead of hiding it immediately.
|
|
||||||
|
|
||||||
\value SH_TabWidget_DefaultTabPosition Default position of the tab bar in a tab widget.
|
\value SH_TabWidget_DefaultTabPosition Default position of the tab bar in a tab widget.
|
||||||
|
|
||||||
\value SH_ToolBar_Movable Determines if the tool bar is movable by default.
|
\value SH_ToolBar_Movable Determines if the tool bar is movable by default.
|
||||||
|
|
|
@ -642,8 +642,6 @@ public:
|
||||||
SH_TextControl_FocusIndicatorTextCharFormat,
|
SH_TextControl_FocusIndicatorTextCharFormat,
|
||||||
SH_ItemView_ArrowKeysNavigateIntoChildren,
|
SH_ItemView_ArrowKeysNavigateIntoChildren,
|
||||||
SH_Menu_Mask,
|
SH_Menu_Mask,
|
||||||
SH_Menu_FlashTriggeredItem,
|
|
||||||
SH_Menu_FadeOutOnHide,
|
|
||||||
SH_SpinBox_ClickAutoRepeatThreshold,
|
SH_SpinBox_ClickAutoRepeatThreshold,
|
||||||
SH_ItemView_PaintAlternatingRowColorsForEmptyArea,
|
SH_ItemView_PaintAlternatingRowColorsForEmptyArea,
|
||||||
SH_FormLayoutWrapPolicy,
|
SH_FormLayoutWrapPolicy,
|
||||||
|
|
|
@ -2372,39 +2372,7 @@ void QComboBox::hidePopup()
|
||||||
{
|
{
|
||||||
Q_D(QComboBox);
|
Q_D(QComboBox);
|
||||||
if (d->container && d->container->isVisible()) {
|
if (d->container && d->container->isVisible()) {
|
||||||
#if !defined(QT_NO_EFFECTS)
|
d->container->hide();
|
||||||
d->model->blockSignals(true);
|
|
||||||
d->container->itemView()->blockSignals(true);
|
|
||||||
d->container->blockSignals(true);
|
|
||||||
// Flash selected/triggered item (if any).
|
|
||||||
if (style()->styleHint(QStyle::SH_Menu_FlashTriggeredItem)) {
|
|
||||||
QItemSelectionModel *selectionModel = view() ? view()->selectionModel() : 0;
|
|
||||||
if (selectionModel && selectionModel->hasSelection()) {
|
|
||||||
QEventLoop eventLoop;
|
|
||||||
const QItemSelection selection = selectionModel->selection();
|
|
||||||
|
|
||||||
// Deselect item and wait 60 ms.
|
|
||||||
selectionModel->select(selection, QItemSelectionModel::Toggle);
|
|
||||||
QTimer::singleShot(60, &eventLoop, SLOT(quit()));
|
|
||||||
eventLoop.exec();
|
|
||||||
|
|
||||||
// Select item and wait 20 ms.
|
|
||||||
selectionModel->select(selection, QItemSelectionModel::Toggle);
|
|
||||||
QTimer::singleShot(20, &eventLoop, SLOT(quit()));
|
|
||||||
eventLoop.exec();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fade out.
|
|
||||||
const bool needFade = style()->styleHint(QStyle::SH_Menu_FadeOutOnHide);
|
|
||||||
d->model->blockSignals(false);
|
|
||||||
d->container->itemView()->blockSignals(false);
|
|
||||||
d->container->blockSignals(false);
|
|
||||||
|
|
||||||
if (!needFade)
|
|
||||||
#endif // QT_NO_EFFECTS
|
|
||||||
// Fade should implicitly hide as well ;-)
|
|
||||||
d->container->hide();
|
|
||||||
}
|
}
|
||||||
d->_q_resetButton();
|
d->_q_resetButton();
|
||||||
}
|
}
|
||||||
|
|
|
@ -355,10 +355,9 @@ QRect QMenuPrivate::actionRect(QAction *act) const
|
||||||
void QMenuPrivate::hideUpToMenuBar()
|
void QMenuPrivate::hideUpToMenuBar()
|
||||||
{
|
{
|
||||||
Q_Q(QMenu);
|
Q_Q(QMenu);
|
||||||
bool fadeMenus = q->style()->styleHint(QStyle::SH_Menu_FadeOutOnHide);
|
|
||||||
if (!tornoff) {
|
if (!tornoff) {
|
||||||
QWidget *caused = causedPopup.widget;
|
QWidget *caused = causedPopup.widget;
|
||||||
hideMenu(q); //hide after getting causedPopup
|
q->close(); //hide after getting causedPopup
|
||||||
while(caused) {
|
while(caused) {
|
||||||
#ifndef QT_NO_MENUBAR
|
#ifndef QT_NO_MENUBAR
|
||||||
if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)) {
|
if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)) {
|
||||||
|
@ -370,9 +369,8 @@ void QMenuPrivate::hideUpToMenuBar()
|
||||||
if (QMenu *m = qobject_cast<QMenu*>(caused)) {
|
if (QMenu *m = qobject_cast<QMenu*>(caused)) {
|
||||||
caused = m->d_func()->causedPopup.widget;
|
caused = m->d_func()->causedPopup.widget;
|
||||||
if (!m->d_func()->tornoff)
|
if (!m->d_func()->tornoff)
|
||||||
hideMenu(m, fadeMenus);
|
m->close();
|
||||||
if (!fadeMenus) // Mac doesn't clear the action until after hidden.
|
m->d_func()->setCurrentAction(0);
|
||||||
m->d_func()->setCurrentAction(0);
|
|
||||||
} else {
|
} else {
|
||||||
caused = 0;
|
caused = 0;
|
||||||
}
|
}
|
||||||
|
@ -381,44 +379,6 @@ void QMenuPrivate::hideUpToMenuBar()
|
||||||
setCurrentAction(0);
|
setCurrentAction(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMenuPrivate::hideMenu(QMenu *menu, bool justRegister)
|
|
||||||
{
|
|
||||||
if (!menu)
|
|
||||||
return;
|
|
||||||
#if !defined(QT_NO_EFFECTS)
|
|
||||||
menu->blockSignals(true);
|
|
||||||
aboutToHide = true;
|
|
||||||
// Flash item which is about to trigger (if any).
|
|
||||||
if (menu->style()->styleHint(QStyle::SH_Menu_FlashTriggeredItem)
|
|
||||||
&& currentAction && currentAction == actionAboutToTrigger
|
|
||||||
&& menu->actions().contains(currentAction)) {
|
|
||||||
QEventLoop eventLoop;
|
|
||||||
QAction *activeAction = currentAction;
|
|
||||||
|
|
||||||
menu->setActiveAction(0);
|
|
||||||
QTimer::singleShot(60, &eventLoop, SLOT(quit()));
|
|
||||||
eventLoop.exec();
|
|
||||||
|
|
||||||
// Select and wait 20 ms.
|
|
||||||
menu->setActiveAction(activeAction);
|
|
||||||
QTimer::singleShot(20, &eventLoop, SLOT(quit()));
|
|
||||||
eventLoop.exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fade out.
|
|
||||||
if (menu->style()->styleHint(QStyle::SH_Menu_FadeOutOnHide)) {
|
|
||||||
// ### Qt 4.4:
|
|
||||||
// Should be something like: q->transitionWindow(Qt::FadeOutTransition, MenuFadeTimeInSec);
|
|
||||||
// Hopefully we'll integrate qt/research/windowtransitions into main before 4.4.
|
|
||||||
// Talk to Richard, Trenton or Bjoern.
|
|
||||||
}
|
|
||||||
aboutToHide = false;
|
|
||||||
menu->blockSignals(false);
|
|
||||||
#endif // QT_NO_EFFECTS
|
|
||||||
if (!justRegister)
|
|
||||||
menu->close();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QMenuPrivate::popupAction(QAction *action, int delay, bool activateFirst)
|
void QMenuPrivate::popupAction(QAction *action, int delay, bool activateFirst)
|
||||||
{
|
{
|
||||||
Q_Q(QMenu);
|
Q_Q(QMenu);
|
||||||
|
@ -429,9 +389,10 @@ void QMenuPrivate::popupAction(QAction *action, int delay, bool activateFirst)
|
||||||
menuDelayTimer.start(delay, q);
|
menuDelayTimer.start(delay, q);
|
||||||
if (activateFirst && action->menu())
|
if (activateFirst && action->menu())
|
||||||
action->menu()->d_func()->setFirstActionActive();
|
action->menu()->d_func()->setFirstActionActive();
|
||||||
} else if (QMenu *menu = activeMenu) { //hide the current item
|
} else if (QMenu *menu = activeMenu) {
|
||||||
|
// hide the current item
|
||||||
activeMenu = 0;
|
activeMenu = 0;
|
||||||
hideMenu(menu);
|
menu->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -545,7 +506,7 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason
|
||||||
// kill any running effect
|
// kill any running effect
|
||||||
qFadeEffect(nullptr);
|
qFadeEffect(nullptr);
|
||||||
#endif
|
#endif
|
||||||
hideMenu(hideActiveMenu);
|
hideActiveMenu->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2097,7 +2058,7 @@ void QMenu::wheelEvent(QWheelEvent *e)
|
||||||
void QMenu::mousePressEvent(QMouseEvent *e)
|
void QMenu::mousePressEvent(QMouseEvent *e)
|
||||||
{
|
{
|
||||||
Q_D(QMenu);
|
Q_D(QMenu);
|
||||||
if (d->aboutToHide || d->mouseEventTaken(e))
|
if (d->mouseEventTaken(e))
|
||||||
return;
|
return;
|
||||||
if (!rect().contains(e->pos())) {
|
if (!rect().contains(e->pos())) {
|
||||||
if (d->noReplayFor
|
if (d->noReplayFor
|
||||||
|
@ -2121,7 +2082,7 @@ void QMenu::mousePressEvent(QMouseEvent *e)
|
||||||
void QMenu::mouseReleaseEvent(QMouseEvent *e)
|
void QMenu::mouseReleaseEvent(QMouseEvent *e)
|
||||||
{
|
{
|
||||||
Q_D(QMenu);
|
Q_D(QMenu);
|
||||||
if (d->aboutToHide || d->mouseEventTaken(e))
|
if (d->mouseEventTaken(e))
|
||||||
return;
|
return;
|
||||||
if(d->mouseDown != this) {
|
if(d->mouseDown != this) {
|
||||||
d->mouseDown = 0;
|
d->mouseDown = 0;
|
||||||
|
@ -2437,7 +2398,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
|
||||||
}
|
}
|
||||||
if (!key_consumed && key == Qt::Key_Left && qobject_cast<QMenu*>(d->causedPopup.widget)) {
|
if (!key_consumed && key == Qt::Key_Left && qobject_cast<QMenu*>(d->causedPopup.widget)) {
|
||||||
QPointer<QWidget> caused = d->causedPopup.widget;
|
QPointer<QWidget> caused = d->causedPopup.widget;
|
||||||
d->hideMenu(this);
|
close();
|
||||||
if (caused)
|
if (caused)
|
||||||
caused->setFocus();
|
caused->setFocus();
|
||||||
key_consumed = true;
|
key_consumed = true;
|
||||||
|
@ -2451,7 +2412,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
|
||||||
key_consumed = true;
|
key_consumed = true;
|
||||||
if (style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, 0, this))
|
if (style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, 0, this))
|
||||||
{
|
{
|
||||||
d->hideMenu(this);
|
close();
|
||||||
#ifndef QT_NO_MENUBAR
|
#ifndef QT_NO_MENUBAR
|
||||||
if (QMenuBar *mb = qobject_cast<QMenuBar*>(QApplication::focusWidget())) {
|
if (QMenuBar *mb = qobject_cast<QMenuBar*>(QApplication::focusWidget())) {
|
||||||
mb->d_func()->setKeyboardMode(false);
|
mb->d_func()->setKeyboardMode(false);
|
||||||
|
@ -2468,7 +2429,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QPointer<QWidget> caused = d->causedPopup.widget;
|
QPointer<QWidget> caused = d->causedPopup.widget;
|
||||||
d->hideMenu(this); // hide after getting causedPopup
|
close(); // hide after getting causedPopup
|
||||||
#ifndef QT_NO_MENUBAR
|
#ifndef QT_NO_MENUBAR
|
||||||
if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)) {
|
if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)) {
|
||||||
mb->d_func()->setCurrentAction(d->menuAction);
|
mb->d_func()->setCurrentAction(d->menuAction);
|
||||||
|
@ -2601,7 +2562,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
|
||||||
void QMenu::mouseMoveEvent(QMouseEvent *e)
|
void QMenu::mouseMoveEvent(QMouseEvent *e)
|
||||||
{
|
{
|
||||||
Q_D(QMenu);
|
Q_D(QMenu);
|
||||||
if (!isVisible() || d->aboutToHide || d->mouseEventTaken(e))
|
if (!isVisible() || d->mouseEventTaken(e))
|
||||||
return;
|
return;
|
||||||
d->motions++;
|
d->motions++;
|
||||||
if (d->motions == 0) // ignore first mouse move event (see enterEvent())
|
if (d->motions == 0) // ignore first mouse move event (see enterEvent())
|
||||||
|
@ -2734,7 +2695,7 @@ void QMenu::internalDelayedPopup()
|
||||||
//hide the current item
|
//hide the current item
|
||||||
if (QMenu *menu = d->activeMenu) {
|
if (QMenu *menu = d->activeMenu) {
|
||||||
d->activeMenu = 0;
|
d->activeMenu = 0;
|
||||||
d->hideMenu(menu);
|
menu->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!d->currentAction || !d->currentAction->isEnabled() || !d->currentAction->menu() ||
|
if (!d->currentAction || !d->currentAction->isEnabled() || !d->currentAction->menu() ||
|
||||||
|
|
|
@ -52,18 +52,21 @@ class QMenuPrivate : public QWidgetPrivate
|
||||||
{
|
{
|
||||||
Q_DECLARE_PUBLIC(QMenu)
|
Q_DECLARE_PUBLIC(QMenu)
|
||||||
public:
|
public:
|
||||||
QMenuPrivate() : itemsDirty(0), maxIconWidth(0), tabWidth(0), ncols(0),
|
QMenuPrivate()
|
||||||
collapsibleSeparators(true), activationRecursionGuard(false),
|
: itemsDirty(0), maxIconWidth(0), tabWidth(0), ncols(0),
|
||||||
hasHadMouse(false), aboutToHide(false), motions(0),
|
collapsibleSeparators(true), activationRecursionGuard(false),
|
||||||
currentAction(0),
|
hasHadMouse(false), motions(0),
|
||||||
scroll(0), eventLoop(0), tearoff(false), tornoff(false), tearoffHighlighted(false),
|
currentAction(0),
|
||||||
hasCheckableItems(false), sloppyDelayTimer(0), sloppyAction(0), doChildEffects(false)
|
scroll(0), eventLoop(0), tearoff(false), tornoff(false), tearoffHighlighted(false),
|
||||||
{ }
|
hasCheckableItems(false), sloppyDelayTimer(0), sloppyAction(0), doChildEffects(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
~QMenuPrivate()
|
~QMenuPrivate()
|
||||||
{
|
{
|
||||||
delete scroll;
|
delete scroll;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
static QMenuPrivate *get(QMenu *m) { return m->d_func(); }
|
static QMenuPrivate *get(QMenu *m) { return m->d_func(); }
|
||||||
|
@ -92,7 +95,6 @@ public:
|
||||||
static QMenu *mouseDown;
|
static QMenu *mouseDown;
|
||||||
QPoint mousePopupPos;
|
QPoint mousePopupPos;
|
||||||
bool hasHadMouse;
|
bool hasHadMouse;
|
||||||
bool aboutToHide;
|
|
||||||
int motions;
|
int motions;
|
||||||
QAction *currentAction;
|
QAction *currentAction;
|
||||||
QBasicTimer menuDelayTimer;
|
QBasicTimer menuDelayTimer;
|
||||||
|
@ -122,11 +124,11 @@ public:
|
||||||
void scrollMenu(QMenuScroller::ScrollDirection direction, bool page=false, bool active=false);
|
void scrollMenu(QMenuScroller::ScrollDirection direction, bool page=false, bool active=false);
|
||||||
void scrollMenu(QAction *action, QMenuScroller::ScrollLocation location, bool active=false);
|
void scrollMenu(QAction *action, QMenuScroller::ScrollLocation location, bool active=false);
|
||||||
|
|
||||||
//synchronous operation (ie exec())
|
// synchronous operation (ie exec())
|
||||||
QEventLoop *eventLoop;
|
QEventLoop *eventLoop;
|
||||||
QPointer<QAction> syncAction;
|
QPointer<QAction> syncAction;
|
||||||
|
|
||||||
//search buffer
|
// search buffer
|
||||||
QString searchBuffer;
|
QString searchBuffer;
|
||||||
QBasicTimer searchBufferTimer;
|
QBasicTimer searchBufferTimer;
|
||||||
|
|
||||||
|
@ -142,7 +144,6 @@ public:
|
||||||
virtual QList<QPointer<QWidget> > calcCausedStack() const;
|
virtual QList<QPointer<QWidget> > calcCausedStack() const;
|
||||||
QMenuCaused causedPopup;
|
QMenuCaused causedPopup;
|
||||||
void hideUpToMenuBar();
|
void hideUpToMenuBar();
|
||||||
void hideMenu(QMenu *menu, bool justRegister = false);
|
|
||||||
|
|
||||||
//index mappings
|
//index mappings
|
||||||
inline QAction *actionAt(int i) const { return q_func()->actions().at(i); }
|
inline QAction *actionAt(int i) const { return q_func()->actions().at(i); }
|
||||||
|
|
Loading…
Add table
Reference in a new issue