Q_DECLARE_PUBLIC(QMenu)
public:
QTornOffMenuPrivate(QMenu *p) : causedMenu(p) {
- tornoff = 1;
+ tornoff = true;
causedPopup.widget = 0;
causedPopup.action = ((QTornOffMenu*)p)->d_func()->causedPopup.action;
causedStack = ((QTornOffMenu*)p)->d_func()->calcCausedStack();
if (action->isSeparator() || !action->isVisible() || widgetItems.contains(action))
continue;
//..and some members
- hasCheckableItems |= action->isCheckable();
+ hasCheckableItems = (!hasCheckableItems && action->isCheckable());
QIcon is = action->icon();
if (!is.isNull()) {
maxIconWidth = qMax<uint>(maxIconWidth, icone + 4);
void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason reason, bool activateFirst)
{
Q_Q(QMenu);
- tearoffHighlighted = 0;
+ tearoffHighlighted = false;
// Reselect the currently active action in case mouse moved over other menu items when
// moving from sub menu action to sub menu (QTBUG-20094).
if (reason != SelectedFromKeyboard && action == currentAction && !(action && action->menu() && action->menu() != activeMenu)) {
q->update(tearRect);
if (tearRect.contains(pos) && hasMouseMoved(e->globalPos())) {
setCurrentAction(0);
- tearoffHighlighted = 1;
+ tearoffHighlighted = true;
if (e->type() == QEvent::MouseButtonRelease) {
if (!tornPopup)
tornPopup = new QTornOffMenu(q);
}
return true;
}
- tearoffHighlighted = 0;
+ tearoffHighlighted = false;
}
if (q->frameGeometry().contains(e->globalPos())) //otherwise if the event is in our rect we want it..
d->scroll->scrollOffset = 0;
d->scroll->scrollFlags = QMenuPrivate::QMenuScroller::ScrollNone;
}
- d->tearoffHighlighted = 0;
+ d->tearoffHighlighted = false;
d->motions = 0;
d->doChildEffects = true;
d->updateLayoutDirection();
break;
}
if (!nextAction && d->tearoff)
- d->tearoffHighlighted = 1;
+ d->tearoffHighlighted = true;
} else {
y += d->actionRects.at(i).height();
for(int next_i = i+1; true; next_i++) {
selectAction(0),
cancelAction(0),
#endif
- scroll(0), eventLoop(0), tearoff(0), tornoff(0), tearoffHighlighted(0),
- hasCheckableItems(0), 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()
{
inline int indexOf(QAction *act) const { return q_func()->actions().indexOf(act); }
//tear off support
- uint tearoff : 1, tornoff : 1, tearoffHighlighted : 1;
+ bool tearoff;
+ bool tornoff;
+ bool tearoffHighlighted;
QPointer<QTornOffMenu> tornPopup;
mutable bool hasCheckableItems;