Commit c117f586 authored by Carsten Fuhrmann's avatar Carsten Fuhrmann
Browse files

found another crash

parent 16bba6b8
#include "ChannelListWidget.h"
#include <QMouseEvent>
#include <Windows.h>
#include <QSizeGrip>
ChannelTree::ChannelTree(QWidget *parent)
: QTreeWidget(parent)
......@@ -9,11 +11,6 @@ ChannelTree::ChannelTree(QWidget *parent)
setHeaderHidden(true);
setExpandsOnDoubleClick(false);
setStyleSheet("padding:2px;border-radius:5px;border-style:solid;border-width:1px;border-color:rgb(100,100,100); background-color:rgba(50,50,50,150); color:rgb(255,255,255);");
resize(200, 400);
m_parent->adjustSize();
}
ChannelTree::~ChannelTree()
......@@ -24,7 +21,7 @@ ChannelTree::~ChannelTree()
void ChannelTree::mousePressEvent(QMouseEvent * event)
{
if (event->button() == Qt::LeftButton)
isMouseDown = true;
doMove = true;
else if (event->button() == Qt::RightButton)
m_parent->hide();
......@@ -33,25 +30,19 @@ void ChannelTree::mousePressEvent(QMouseEvent * event)
void ChannelTree::mouseReleaseEvent(QMouseEvent * event)
{
isMouseDown = false;
doMove = false;
QTreeWidget::mouseReleaseEvent(event);
}
void ChannelTree::mouseMoveEvent(QMouseEvent * event)
{
if (isMouseDown)
if (doMove)
m_parent->move(event->globalPos());
QTreeWidget::mouseMoveEvent(event);
}
void ChannelTree::resizeEvent(QResizeEvent * event)
{
m_parent->resize(this->size());
QTreeWidget::resizeEvent(event);
}
///////////////////////////////////////////////////////////////////////////////////////
......@@ -59,11 +50,10 @@ ChannelListWidget::ChannelListWidget(QWidget *parent)
: QWidget(parent)
{
setAttribute(Qt::WA_TranslucentBackground);
setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint);
setGeometry(320, 200, 1, 1);
setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::SplashScreen);
move(320, 200);
m_child = new ChannelTree(this);
m_child->show();
show();
}
......
......@@ -15,10 +15,10 @@ protected:
virtual void mousePressEvent(QMouseEvent * event) Q_DECL_OVERRIDE;
virtual void mouseReleaseEvent(QMouseEvent * event) Q_DECL_OVERRIDE;
virtual void mouseMoveEvent(QMouseEvent * event) Q_DECL_OVERRIDE;
virtual void resizeEvent(QResizeEvent * event) Q_DECL_OVERRIDE;
private:
bool isMouseDown = false;
bool doMove = false;
QPoint m_oldPosition;
QWidget *m_parent;
public:
......@@ -33,7 +33,6 @@ public:
explicit ChannelListWidget(QWidget *parent = NULL);
~ChannelListWidget();
private:
ChannelTree *m_child;
......
......@@ -296,6 +296,7 @@ void OverlayController::displayChannelList()
m_tree->getTree()->expandAll();
connect(m_tree->getTree(), &QTreeWidget::itemDoubleClicked, this, &OverlayController::treeItemClicked);
m_tree->getTree()->adjustSize();
m_tree->adjustSize();
m_tree->show();
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment