mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 15:37:23 +00:00
some work
This commit is contained in:
parent
e64ca5ec08
commit
0b3832cc32
@ -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 ()
|
||||
|
@ -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();
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -38,6 +38,8 @@ void AwesomeWidget::reinit()
|
||||
else
|
||||
textLabel->setPopupEnabled(true);
|
||||
updateText(true);
|
||||
textLabel->adjustSize();
|
||||
mainLayout->itemAt(0, 0)->adjustSize();
|
||||
|
||||
keys = getKeys();
|
||||
foundKeys = findKeys();
|
||||
|
Loading…
Reference in New Issue
Block a user