cutter/src/common/DirectionalComboBox.cpp
2021-01-24 18:34:16 +02:00

22 lines
581 B
C++

#include "DirectionalComboBox.h"
DirectionalComboBox::DirectionalComboBox(QWidget *parent, bool upwards)
: QComboBox(parent), popupUpwards(upwards)
{
}
void DirectionalComboBox::showPopup()
{
QComboBox::showPopup();
QWidget *popup = this->findChild<QFrame *>();
if (popupUpwards) {
popup->move(popup->x(), mapToGlobal(this->rect().bottomLeft()).y() - popup->height());
} else {
popup->move(popup->x(), mapToGlobal(this->rect().topLeft()).y());
}
}
void DirectionalComboBox::setPopupDirection(bool upwards)
{
popupUpwards = upwards;
}