adjustGeometry is protected
This commit is contained in:
parent
8b114a3f59
commit
49252b0b5d
@ -337,7 +337,7 @@ void DialogPrivate::syncToMainItemSize()
|
|||||||
frameSvgItem->margins()->top() + frameSvgItem->margins()->bottom());
|
frameSvgItem->margins()->top() + frameSvgItem->margins()->bottom());
|
||||||
|
|
||||||
if (q->visualParent()) {
|
if (q->visualParent()) {
|
||||||
const QRect geom(q->popupPosition(q->visualParent(), s, Qt::AlignCenter), s);
|
const QRect geom(q->popupPosition(q->visualParent(), s), s);
|
||||||
|
|
||||||
if (geom == q->geometry()) {
|
if (geom == q->geometry()) {
|
||||||
return;
|
return;
|
||||||
@ -494,7 +494,7 @@ void Dialog::setVisualParent(QQuickItem *visualParent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QPoint Dialog::popupPosition(QQuickItem *item, const QSize &size, Qt::AlignmentFlag alignment)
|
QPoint Dialog::popupPosition(QQuickItem *item, const QSize &size)
|
||||||
{
|
{
|
||||||
if (!item) {
|
if (!item) {
|
||||||
//If no item was specified try to align at the center of the parent view
|
//If no item was specified try to align at the center of the parent view
|
||||||
@ -532,15 +532,6 @@ QPoint Dialog::popupPosition(QQuickItem *item, const QSize &size, Qt::AlignmentF
|
|||||||
return QPoint();
|
return QPoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
//swap direction if necessary
|
|
||||||
if (QApplication::isRightToLeft() && alignment != Qt::AlignCenter) {
|
|
||||||
if (alignment == Qt::AlignRight) {
|
|
||||||
alignment = Qt::AlignLeft;
|
|
||||||
} else {
|
|
||||||
alignment = Qt::AlignRight;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//if the item is in a dock or in a window that ignores WM we want to position the popups outside of the dock
|
//if the item is in a dock or in a window that ignores WM we want to position the popups outside of the dock
|
||||||
const KWindowInfo winInfo = KWindowSystem::windowInfo(item->window()->winId(), NET::WMWindowType);
|
const KWindowInfo winInfo = KWindowSystem::windowInfo(item->window()->winId(), NET::WMWindowType);
|
||||||
const bool outsideParentWindow = (winInfo.windowType(NET::AllTypesMask) == NET::Dock) || (item->window()->flags() & Qt::X11BypassWindowManagerHint);
|
const bool outsideParentWindow = (winInfo.windowType(NET::AllTypesMask) == NET::Dock) || (item->window()->flags() & Qt::X11BypassWindowManagerHint);
|
||||||
|
@ -113,6 +113,7 @@ public:
|
|||||||
Dialog(QQuickItem *parent = 0);
|
Dialog(QQuickItem *parent = 0);
|
||||||
~Dialog();
|
~Dialog();
|
||||||
|
|
||||||
|
//PROPERTIES ACCESSORS
|
||||||
QQuickItem *mainItem() const;
|
QQuickItem *mainItem() const;
|
||||||
void setMainItem(QQuickItem *mainItem);
|
void setMainItem(QQuickItem *mainItem);
|
||||||
|
|
||||||
@ -125,17 +126,6 @@ public:
|
|||||||
QObject *margins() const;
|
QObject *margins() const;
|
||||||
|
|
||||||
void setFramelessFlags(Qt::WindowFlags flags);
|
void setFramelessFlags(Qt::WindowFlags flags);
|
||||||
/*
|
|
||||||
* set the dialog position. subclasses may change it. ToolTipDialog adjusts the position in an animated way
|
|
||||||
*/
|
|
||||||
virtual void adjustGeometry(const QRect &geom);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns The suggested screen position for the popup
|
|
||||||
* @arg item the item the popup has to be positioned relatively to. if null, the popup will be positioned in the center of the window
|
|
||||||
* @arg alignment alignment of the popup compared to the item
|
|
||||||
*/
|
|
||||||
QPoint popupPosition(QQuickItem *item, const QSize &size, Qt::AlignmentFlag alignment=Qt::AlignCenter) ;
|
|
||||||
|
|
||||||
void setType(WindowType type);
|
void setType(WindowType type);
|
||||||
WindowType type() const;
|
WindowType type() const;
|
||||||
@ -147,6 +137,13 @@ public:
|
|||||||
|
|
||||||
void setTransientParentAndNotify(QWindow *parent);
|
void setTransientParentAndNotify(QWindow *parent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns The suggested screen position for the popup
|
||||||
|
* @arg item the item the popup has to be positioned relatively to. if null, the popup will be positioned in the center of the window
|
||||||
|
* @arg alignment alignment of the popup compared to the item
|
||||||
|
*/
|
||||||
|
virtual QPoint popupPosition(QQuickItem *item, const QSize &size);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void mainItemChanged();
|
void mainItemChanged();
|
||||||
void locationChanged();
|
void locationChanged();
|
||||||
@ -158,6 +155,11 @@ Q_SIGNALS:
|
|||||||
void flagsChanged();
|
void flagsChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
/*
|
||||||
|
* set the dialog position. subclasses may change it. ToolTipDialog adjusts the position in an animated way
|
||||||
|
*/
|
||||||
|
virtual void adjustGeometry(const QRect &geom);
|
||||||
|
|
||||||
//Reimplementations
|
//Reimplementations
|
||||||
virtual void classBegin();
|
virtual void classBegin();
|
||||||
virtual void componentComplete();
|
virtual void componentComplete();
|
||||||
@ -169,6 +171,7 @@ protected:
|
|||||||
virtual bool event(QEvent *event);
|
virtual bool event(QEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
friend class DialogPrivate;
|
||||||
DialogPrivate *const d;
|
DialogPrivate *const d;
|
||||||
|
|
||||||
Q_PRIVATE_SLOT(d, void syncBorders())
|
Q_PRIVATE_SLOT(d, void syncBorders())
|
||||||
|
@ -133,7 +133,7 @@ void ToolTip::showToolTip()
|
|||||||
if (window() && window()->screen()) {
|
if (window() && window()->screen()) {
|
||||||
pos = window()->mapToGlobal(pos);
|
pos = window()->mapToGlobal(pos);
|
||||||
}
|
}
|
||||||
QPoint popupPos = dlg->popupPosition(this, dlg->size(), Qt::AlignCenter);
|
QPoint popupPos = dlg->popupPosition(this, dlg->size());
|
||||||
|
|
||||||
if (pos.y() + height() <= popupPos.y()) {
|
if (pos.y() + height() <= popupPos.y()) {
|
||||||
dir = Plasma::Types::Down;
|
dir = Plasma::Types::Down;
|
||||||
|
Loading…
Reference in New Issue
Block a user