mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 23:47:20 +00:00
some work
This commit is contained in:
parent
e64ca5ec08
commit
0b3832cc32
@ -16,7 +16,7 @@ message (STATUS "Version: ${PROJECT_VERSION}")
|
|||||||
|
|
||||||
# flags
|
# flags
|
||||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
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_DEBUG "-g -O0")
|
||||||
set (CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
|
set (CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
|
||||||
else ()
|
else ()
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QGraphicsGridLayout>
|
#include <QGraphicsGridLayout>
|
||||||
|
#include <QGraphicsProxyWidget>
|
||||||
#include <QGraphicsScene>
|
#include <QGraphicsScene>
|
||||||
#include <QGraphicsView>
|
#include <QGraphicsView>
|
||||||
#include <QNetworkInterface>
|
#include <QNetworkInterface>
|
||||||
@ -199,7 +200,13 @@ void AwesomeWidget::init()
|
|||||||
mainLayout->setContentsMargins(1, 1, 1, 1);
|
mainLayout->setContentsMargins(1, 1, 1, 1);
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
textLabel = new CustomLabel(this, debug);
|
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
|
// read variables
|
||||||
configChanged();
|
configChanged();
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
|
|
||||||
CustomLabel::CustomLabel(AwesomeWidget *wid, const bool debugCmd)
|
CustomLabel::CustomLabel(AwesomeWidget *wid, const bool debugCmd)
|
||||||
: Plasma::Label(wid),
|
: QLabel(0),
|
||||||
widget(wid),
|
widget(wid),
|
||||||
debug(debugCmd)
|
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;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Get signal" << event->button();
|
if (debug) qDebug() << PDEBUG << ":" << "Get signal" << event->button();
|
||||||
@ -93,5 +93,5 @@ void CustomLabel::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
|
|
||||||
widget->sendNotification(QString("system"), text);
|
widget->sendNotification(QString("system"), text);
|
||||||
}
|
}
|
||||||
emit(Plasma::Label::mousePressEvent(event));
|
emit(QLabel::mousePressEvent(event));
|
||||||
}
|
}
|
||||||
|
@ -18,22 +18,22 @@
|
|||||||
#ifndef CUSTOMLABEL_H
|
#ifndef CUSTOMLABEL_H
|
||||||
#define CUSTOMLABEL_H
|
#define CUSTOMLABEL_H
|
||||||
|
|
||||||
#include <Plasma/Label>
|
#include <QLabel>
|
||||||
|
|
||||||
|
|
||||||
class AwesomeWidget;
|
class AwesomeWidget;
|
||||||
|
|
||||||
class CustomLabel : public Plasma::Label
|
class CustomLabel : public QLabel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CustomLabel(AwesomeWidget *wid, const bool debugCmd);
|
CustomLabel(AwesomeWidget *wid, const bool debugCmd = false);
|
||||||
~CustomLabel();
|
~CustomLabel();
|
||||||
void setPopupEnabled(const bool state);
|
void setPopupEnabled(const bool state);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
void mousePressEvent(QMouseEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AwesomeWidget *widget;
|
AwesomeWidget *widget;
|
||||||
|
@ -38,6 +38,8 @@ void AwesomeWidget::reinit()
|
|||||||
else
|
else
|
||||||
textLabel->setPopupEnabled(true);
|
textLabel->setPopupEnabled(true);
|
||||||
updateText(true);
|
updateText(true);
|
||||||
|
textLabel->adjustSize();
|
||||||
|
mainLayout->itemAt(0, 0)->adjustSize();
|
||||||
|
|
||||||
keys = getKeys();
|
keys = getKeys();
|
||||||
foundKeys = findKeys();
|
foundKeys = findKeys();
|
||||||
|
Loading…
Reference in New Issue
Block a user