mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-13 10:32:11 +01:00
Also add the new files to the git index...
This commit is contained in:
parent
f3221c70d6
commit
eb2256e2cf
29
src/lib/navigation/locationbarpopup.cpp
Normal file
29
src/lib/navigation/locationbarpopup.cpp
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
|
||||||
|
#include <QLayout>
|
||||||
|
|
||||||
|
#include "locationbarpopup.h"
|
||||||
|
|
||||||
|
LocationBarPopup::LocationBarPopup(QWidget* parent)
|
||||||
|
: QFrame(parent, Qt::Popup)
|
||||||
|
, m_alignment(Qt::AlignRight)
|
||||||
|
{
|
||||||
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
setFrameStyle(QFrame::Panel | QFrame::Raised);
|
||||||
|
setLineWidth(1);
|
||||||
|
setMidLineWidth(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LocationBarPopup::showAt(QWidget* parent)
|
||||||
|
{
|
||||||
|
layout()->invalidate();
|
||||||
|
layout()->activate();
|
||||||
|
|
||||||
|
QPoint p = parent->mapToGlobal(QPoint(0, 0));
|
||||||
|
if (m_alignment == Qt::AlignRight) {
|
||||||
|
p.setX(p.x() + parent->width() - width());
|
||||||
|
}
|
||||||
|
p.setY(p.y() + parent->height());
|
||||||
|
move(p);
|
||||||
|
|
||||||
|
show();
|
||||||
|
}
|
24
src/lib/navigation/locationbarpopup.h
Normal file
24
src/lib/navigation/locationbarpopup.h
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
|
||||||
|
#ifndef QUPZILLA_LOCATION_BAR_POPUP
|
||||||
|
#define QUPZILLA_LOCATION_BAR_POPUP
|
||||||
|
|
||||||
|
#include <QFrame>
|
||||||
|
|
||||||
|
class LocationBarPopup : public QFrame
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LocationBarPopup(QWidget* parent);
|
||||||
|
void showAt(QWidget* parent);
|
||||||
|
void setPopupAlignment(Qt::Alignment alignment) {
|
||||||
|
m_alignment = alignment;
|
||||||
|
}
|
||||||
|
|
||||||
|
Qt::Alignment popupAlignment() const {
|
||||||
|
return m_alignment;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Qt::Alignment m_alignment;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user