add workaround for #34 to AW

This commit is contained in:
arcan1s 2014-10-27 04:20:13 +03:00
parent 6463ed3bf7
commit 13023a4985
4 changed files with 6 additions and 5 deletions

View File

@ -219,7 +219,9 @@ 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);
textLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
QGraphicsProxyWidget *pw = new QGraphicsProxyWidget(this); QGraphicsProxyWidget *pw = new QGraphicsProxyWidget(this);
pw->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
textLabel->setAttribute(Qt::WA_TranslucentBackground, true); textLabel->setAttribute(Qt::WA_TranslucentBackground, true);
pw->setWidget(textLabel); pw->setWidget(textLabel);
mainLayout->addItem(pw, 0, 0); mainLayout->addItem(pw, 0, 0);

View File

@ -662,7 +662,7 @@ void AwesomeWidget::configChanged()
fontStyle = QString("italic"); fontStyle = QString("italic");
else else
fontStyle = QString("normal"); fontStyle = QString("normal");
formatLine[0] = QString("<html><head><style type=\"text/css\">p, li { white-space: pre-wrap; }</style>\ formatLine[0] = QString("<html><head><style type=\"text/css\">body { white-space: pre-wrap; }</style>\
</head><body style=\"font-family:'%1'; font-size:%2pt; font-weight:%3; font-style:%4; color:%5;\">") </head><body style=\"font-family:'%1'; font-size:%2pt; font-weight:%3; font-style:%4; color:%5;\">")
.arg(font.family()) .arg(font.family())
.arg(font.pointSize()) .arg(font.pointSize())

View File

@ -93,5 +93,5 @@ void CustomLabel::mousePressEvent(QMouseEvent *event)
widget->sendNotification(QString("system"), text); widget->sendNotification(QString("system"), text);
} }
emit(QLabel::mousePressEvent(event)); emit(QWidget::mousePressEvent(event));
} }

View File

@ -38,8 +38,6 @@ void AwesomeWidget::reinit()
else else
textLabel->setPopupEnabled(true); textLabel->setPopupEnabled(true);
updateText(true); updateText(true);
textLabel->adjustSize();
mainLayout->itemAt(0, 0)->setGeometry(textLabel->geometry());
keys = getKeys(); keys = getKeys();
foundKeys = findKeys(); foundKeys = findKeys();
@ -86,7 +84,8 @@ void AwesomeWidget::updateText(const bool clear)
text.replace(QString("$\\$\\"), QString("$$")); text.replace(QString("$\\$\\"), QString("$$"));
} }
textLabel->setText(formatLine[0] + text + formatLine[1]); textLabel->setText(formatLine[0] + text + formatLine[1]);
update(); mainLayout->itemAt(0, 0)->updateGeometry();
updateGeometry();
} }