some work

This commit is contained in:
arcan1s 2014-09-18 21:57:59 +04:00
parent e64ca5ec08
commit 0b3832cc32
5 changed files with 18 additions and 9 deletions

View File

@ -16,7 +16,7 @@ message (STATUS "Version: ${PROJECT_VERSION}")
# flags
if (CMAKE_COMPILER_IS_GNUCXX)
set (CMAKE_CXX_FLAGS "-Wall -std=c++11")
set (CMAKE_CXX_FLAGS "-Wall -Wno-cpp -std=c++11")
set (CMAKE_CXX_FLAGS_DEBUG "-g -O0")
set (CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
else ()

View File

@ -22,6 +22,7 @@
#include <QDesktopServices>
#include <QDir>
#include <QGraphicsGridLayout>
#include <QGraphicsProxyWidget>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QNetworkInterface>
@ -199,7 +200,13 @@ void AwesomeWidget::init()
mainLayout->setContentsMargins(1, 1, 1, 1);
setLayout(mainLayout);
textLabel = new CustomLabel(this, debug);
mainLayout->addItem(textLabel, 0, 0);
QGraphicsProxyWidget *pw = new QGraphicsProxyWidget(this);
pw->setAttribute(Qt::WA_TranslucentBackground, true);
pw->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
textLabel->setAttribute(Qt::WA_TranslucentBackground, true);
textLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
pw->setWidget(textLabel);
mainLayout->addItem(pw, 0, 0);
// read variables
configChanged();

View File

@ -26,7 +26,7 @@
CustomLabel::CustomLabel(AwesomeWidget *wid, const bool debugCmd)
: Plasma::Label(wid),
: QLabel(0),
widget(wid),
debug(debugCmd)
{
@ -49,7 +49,7 @@ void CustomLabel::setPopupEnabled(const bool state)
}
void CustomLabel::mousePressEvent(QGraphicsSceneMouseEvent *event)
void CustomLabel::mousePressEvent(QMouseEvent *event)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Get signal" << event->button();
@ -93,5 +93,5 @@ void CustomLabel::mousePressEvent(QGraphicsSceneMouseEvent *event)
widget->sendNotification(QString("system"), text);
}
emit(Plasma::Label::mousePressEvent(event));
emit(QLabel::mousePressEvent(event));
}

View File

@ -18,22 +18,22 @@
#ifndef CUSTOMLABEL_H
#define CUSTOMLABEL_H
#include <Plasma/Label>
#include <QLabel>
class AwesomeWidget;
class CustomLabel : public Plasma::Label
class CustomLabel : public QLabel
{
Q_OBJECT
public:
CustomLabel(AwesomeWidget *wid, const bool debugCmd);
CustomLabel(AwesomeWidget *wid, const bool debugCmd = false);
~CustomLabel();
void setPopupEnabled(const bool state);
protected:
void mousePressEvent(QGraphicsSceneMouseEvent *event);
void mousePressEvent(QMouseEvent *event);
private:
AwesomeWidget *widget;

View File

@ -38,6 +38,8 @@ void AwesomeWidget::reinit()
else
textLabel->setPopupEnabled(true);
updateText(true);
textLabel->adjustSize();
mainLayout->itemAt(0, 0)->adjustSize();
keys = getKeys();
foundKeys = findKeys();