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());
|
||||
|
||||
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()) {
|
||||
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 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();
|
||||
}
|
||||
|
||||
//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
|
||||
const KWindowInfo winInfo = KWindowSystem::windowInfo(item->window()->winId(), NET::WMWindowType);
|
||||
const bool outsideParentWindow = (winInfo.windowType(NET::AllTypesMask) == NET::Dock) || (item->window()->flags() & Qt::X11BypassWindowManagerHint);
|
||||
|
@ -113,6 +113,7 @@ public:
|
||||
Dialog(QQuickItem *parent = 0);
|
||||
~Dialog();
|
||||
|
||||
//PROPERTIES ACCESSORS
|
||||
QQuickItem *mainItem() const;
|
||||
void setMainItem(QQuickItem *mainItem);
|
||||
|
||||
@ -125,17 +126,6 @@ public:
|
||||
QObject *margins() const;
|
||||
|
||||
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);
|
||||
WindowType type() const;
|
||||
@ -147,6 +137,13 @@ public:
|
||||
|
||||
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:
|
||||
void mainItemChanged();
|
||||
void locationChanged();
|
||||
@ -158,6 +155,11 @@ Q_SIGNALS:
|
||||
void flagsChanged();
|
||||
|
||||
protected:
|
||||
/*
|
||||
* set the dialog position. subclasses may change it. ToolTipDialog adjusts the position in an animated way
|
||||
*/
|
||||
virtual void adjustGeometry(const QRect &geom);
|
||||
|
||||
//Reimplementations
|
||||
virtual void classBegin();
|
||||
virtual void componentComplete();
|
||||
@ -169,6 +171,7 @@ protected:
|
||||
virtual bool event(QEvent *event);
|
||||
|
||||
private:
|
||||
friend class DialogPrivate;
|
||||
DialogPrivate *const d;
|
||||
|
||||
Q_PRIVATE_SLOT(d, void syncBorders())
|
||||
|
@ -133,7 +133,7 @@ void ToolTip::showToolTip()
|
||||
if (window() && window()->screen()) {
|
||||
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()) {
|
||||
dir = Plasma::Types::Down;
|
||||
|
Loading…
Reference in New Issue
Block a user