-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #571 from Tarsnap/tasidelabel
TAsideLabel
- Loading branch information
Showing
13 changed files
with
181 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#include "TAsideLabelPlugin.h" | ||
|
||
WARNINGS_DISABLE | ||
#include <QStringLiteral> | ||
WARNINGS_ENABLE | ||
|
||
class QWidget; | ||
|
||
#include "TAsideLabel.h" | ||
|
||
TAsideLabelPlugin::TAsideLabelPlugin(QObject *parent) : QObject(parent) | ||
{ | ||
} | ||
|
||
QIcon TAsideLabelPlugin::icon() const | ||
{ | ||
return (QIcon()); | ||
} | ||
|
||
QString TAsideLabelPlugin::group() const | ||
{ | ||
return (QStringLiteral("Display Widgets")); | ||
} | ||
|
||
QString TAsideLabelPlugin::includeFile() const | ||
{ | ||
return (QStringLiteral("TAsideLabel.h")); | ||
} | ||
|
||
QString TAsideLabelPlugin::name() const | ||
{ | ||
return (QStringLiteral("TAsideLabel")); | ||
} | ||
|
||
QString TAsideLabelPlugin::toolTip() const | ||
{ | ||
return (QString()); | ||
} | ||
|
||
QString TAsideLabelPlugin::whatsThis() const | ||
{ | ||
return (QString()); | ||
} | ||
|
||
QWidget *TAsideLabelPlugin::createWidget(QWidget *parent) | ||
{ | ||
return (new TAsideLabel(parent)); | ||
} | ||
|
||
bool TAsideLabelPlugin::isContainer() const | ||
{ | ||
return (false); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#ifndef TASIDELABELPLUGIN_H | ||
#define TASIDELABELPLUGIN_H | ||
|
||
#include "warnings-disable.h" | ||
|
||
WARNINGS_DISABLE | ||
#include <QDesignerCustomWidgetInterface> | ||
#include <QIcon> | ||
#include <QObject> | ||
#include <QString> | ||
WARNINGS_ENABLE | ||
|
||
/* Forward declaration(s). */ | ||
class QWidget; | ||
|
||
class TAsideLabelPlugin : public QObject, public QDesignerCustomWidgetInterface | ||
{ | ||
Q_OBJECT | ||
Q_INTERFACES(QDesignerCustomWidgetInterface) | ||
|
||
public: | ||
explicit TAsideLabelPlugin(QObject *parent = nullptr); | ||
|
||
QIcon icon() const override; | ||
QString group() const override; | ||
QString includeFile() const override; | ||
QString name() const override; | ||
QString toolTip() const override; | ||
QString whatsThis() const override; | ||
QWidget *createWidget(QWidget *parent) override; | ||
bool isContainer() const override; | ||
}; | ||
|
||
#endif /* !TASIDELABELPLUGIN_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include "TAsideLabel.h" | ||
|
||
WARNINGS_DISABLE | ||
#include <QFont> | ||
WARNINGS_ENABLE | ||
|
||
#define SHEET_ASIDE \ | ||
"margin-left: 0.125em;" \ | ||
"border-width: 0 0 0 0.1em;" \ | ||
"border-style: solid;" \ | ||
"border-color: palette(mid);" \ | ||
"padding-left: 0.25em;" | ||
|
||
TAsideLabel::TAsideLabel(QWidget *parent) : QLabel(parent) | ||
{ | ||
// Make it italic. | ||
QFont font = this->font(); | ||
font.setStyle(QFont::StyleItalic); | ||
setFont(font); | ||
|
||
// Add the border and padding. | ||
setStyleSheet(SHEET_ASIDE); | ||
|
||
// Word wrap. | ||
setWordWrap(true); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef TASIDELABEL_H | ||
#define TASIDELABEL_H | ||
|
||
#include "warnings-disable.h" | ||
|
||
WARNINGS_DISABLE | ||
#include <QLabel> | ||
#include <QObject> | ||
WARNINGS_ENABLE | ||
|
||
/* Forward declaration(s). */ | ||
class QWidget; | ||
|
||
/*! | ||
* \ingroup lib-widgets | ||
* \brief The TAsideLabel widget is a QLabel which is similar to \<aside\>. | ||
*/ | ||
class TAsideLabel : public QLabel | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
//! Constructor. | ||
explicit TAsideLabel(QWidget *parent = nullptr); | ||
}; | ||
|
||
#endif // TASIDELABEL_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters