mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 21:56:43 +08:00
refs #935, resizing for message frame
also avoid showing overlay message too soon (ie when not full initialized)
This commit is contained in:
committed by
Mathew Sutcliffe
parent
f34e80ea62
commit
be24d069fe
@@ -12,21 +12,25 @@
|
||||
#include "blackgui/stylesheetutility.h"
|
||||
#include "blackgui/guiutility.h"
|
||||
#include "blackmisc/network/textmessage.h"
|
||||
#include "blackmisc/verify.h"
|
||||
|
||||
#include <QKeyEvent>
|
||||
#include <QPoint>
|
||||
#include <QRect>
|
||||
#include <QStyle>
|
||||
#include <Qt>
|
||||
#include <algorithm>
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
COverlayMessagesFrame::COverlayMessagesFrame(QWidget *parent) :
|
||||
QFrame(parent)
|
||||
{ }
|
||||
{
|
||||
// void
|
||||
}
|
||||
|
||||
COverlayMessagesFrame::~COverlayMessagesFrame()
|
||||
{}
|
||||
{ }
|
||||
|
||||
void COverlayMessagesFrame::showStatusMessagesFrame()
|
||||
{
|
||||
@@ -42,11 +46,6 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
void COverlayMessagesFrame::hideStatusMessagesFrame()
|
||||
{
|
||||
if (!m_overlayMessages) { return; }
|
||||
}
|
||||
|
||||
void COverlayMessagesFrame::showOverlayMessagesWithConfirmation(const BlackMisc::CStatusMessageList &messages, const QString &confirmationMessage, std::function<void ()> okLambda, int defaultButton, int timeOutMs)
|
||||
{
|
||||
if (messages.isEmpty()) { return; }
|
||||
@@ -106,10 +105,21 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
void COverlayMessagesFrame::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
QFrame::resizeEvent(event);
|
||||
if (this->m_overlayMessages && this->m_overlayMessages->isVisible())
|
||||
{
|
||||
this->initInnerFrame();
|
||||
}
|
||||
}
|
||||
|
||||
QSize COverlayMessagesFrame::innerFrameSize() const
|
||||
{
|
||||
const int w = this->width();
|
||||
const int h = this->height();
|
||||
// check against minimum if widget is initialized, but not yet resized
|
||||
const int w = std::max(this->width(), this->minimumWidth());
|
||||
const int h = std::max(this->height(), this->minimumHeight());
|
||||
|
||||
int wInner = this->m_widthFactor * w;
|
||||
int hInner = this->m_heightFactor * h;
|
||||
if (wInner > this->maximumWidth()) wInner = this->maximumWidth();
|
||||
@@ -122,6 +132,7 @@ namespace BlackGui
|
||||
const QSize inner(innerFrameSize());
|
||||
if (!this->m_overlayMessages)
|
||||
{
|
||||
// lazy init
|
||||
this->m_overlayMessages = new COverlayMessages(inner.width(), inner.height(), this);
|
||||
this->m_overlayMessages->addShadow();
|
||||
this->m_overlayMessages->showKillButton(m_showKillButton);
|
||||
|
||||
Reference in New Issue
Block a user