33 #include "ginteractor.h" 39 class _Internal_QLabel;
55 GLabel(
const string& text =
"",
const string& iconFileName =
"", QWidget* parent =
nullptr);
60 GLabel(
const string& text,
const QIcon& icon, QWidget* parent =
nullptr);
65 GLabel(
const string& text,
const QPixmap& icon, QWidget* parent =
nullptr);
95 string
getType()
const override;
107 void setBounds(
double x,
double y,
double width,
double height)
override;
116 void setColor(
const string& color)
override;
119 void setFont(
const QFont& font)
override;
122 void setFont(
const string& font)
override;
134 void setIcon(
const QIcon& icon)
override;
137 void setIcon(
const QPixmap& icon)
override;
140 void setIcon(
const string& filename,
bool retainIconSize =
true)
override;
146 virtual void setLabel(
const string& text);
152 void setSize(
double width,
double height)
override;
161 virtual void setText(
const string& text);
173 void setWidth(
double width)
override;
182 void setX(
double x)
override;
185 void setY(
double y)
override;
189 _Internal_QLabel* _iqlabel;
193 GText* getGText()
const;
194 bool hasGText()
const;
196 friend class _Internal_QLabel;
208 class _Internal_QLabel :
public QLabel,
public _Internal_QWidget {
212 _Internal_QLabel(
GLabel* glabel, QWidget* parent =
nullptr);
213 void detach()
override;
214 QSize sizeHint()
const override;
218 void doubleClicked();
221 void mouseDoubleClickEvent(QMouseEvent* e)
override;
222 void mousePressEvent(QMouseEvent* event)
override;
This class represents a graphics window that supports simple graphics.
Definition: gwindow.h:102
void setWidth(double width) override
Sets the onscreen width of the interactor in pixels.
Definition: glabel.cpp:298
This struct contains real-valued x, y, width, and height fields.
Definition: gtypes.h:293
void setFont(const QFont &font) override
Sets the font used by this widget to the given Qt font.
Definition: glabel.cpp:156
void setHeight(double height) override
Sets the onscreen height of the interactor in pixels.
Definition: glabel.cpp:184
TextPosition
The places where an interactor can place its text relative to its icon.
Definition: ginteractor.h:57
A GLabel represents a text string.
Definition: glabel.h:50
void setBounds(double x, double y, double width, double height) override
Sets the size and location of the widget.
Definition: glabel.cpp:128
virtual void setTextPosition(GInteractor::TextPosition position)
Sets the label's text position relative to its icon.
Definition: glabel.cpp:280
void setLocation(double x, double y) override
Sets the onscreen x/y-coordinate of the top-left corner of the interactor relative to its window...
Definition: glabel.cpp:252
void setSize(double width, double height) override
Sets the onscreen width and height of the interactor in pixels.
Definition: glabel.cpp:258
_Internal_QWidget* getInternalWidget() const override
Returns a direct pointer to the internal Qt widget being wrapped by this interactor.
Definition: glabel.cpp:85
GLabel(string text="", string iconFileName="", QWidget* parent=nullptr)
Creates a label with the specified text label and optional icon.
Definition: glabel.cpp:36
virtual void setLabel(string text)
Sets the text on the label to be the given text.
Definition: glabel.cpp:248
virtual string getText() const
Returns the string displayed by the label.
Definition: glabel.cpp:93
virtual void setWordWrap(bool wrap)
Sets whether the label should wrap if its text is too long.
Definition: glabel.cpp:304
void setForeground(int rgb) override
Sets the foreground/text color of the interactor to the color represented by the given RGB integer...
Definition: glabel.cpp:170
This abstract class is the superclass for all graphical interactors.
Definition: ginteractor.h:52
GLabel GTextLabel
Definition: glabel.h:201
void setIcon(const QIcon &icon) override
Sets the icon associated with this interactor.
Definition: glabel.cpp:190
This graphical object subclass represents a text string.
Definition: gobjects.h:1446
void setColor(int rgb) override
Sets the foreground/text color of the interactor to the color represented by the given RGB integer...
Definition: glabel.cpp:142
virtual void setText(string text)
Sets the text on the label to be the given text.
Definition: glabel.cpp:270
virtual string getLabel() const
Returns the string displayed by the label.
Definition: glabel.cpp:89
This struct contains real-valued width and height fields.
Definition: gtypes.h:43
virtual GInteractor::TextPosition getTextPosition() const
Returns the label's text position relative to its icon.
Definition: glabel.cpp:97
QWidget* getWidget() const override
Returns a direct pointer to the internal Qt widget being wrapped by this interactor.
Definition: glabel.cpp:116
void setVisible(bool visible) override
Returns true if the interactor is visible on the screen.
Definition: glabel.cpp:291
void setX(double x) override
Sets the onscreen x-coordinate of the top-left corner of the interactor relative to its window...
Definition: glabel.cpp:310
virtual bool isWordWrap() const
Returns whether the label should wrap if its text is too long.
Definition: glabel.cpp:124
string getType() const override
Returns a string representing the class name of this interactor, such as "GButton" or "GCheckBox"...
Definition: glabel.cpp:112
void setY(double y) override
Sets the onscreen y-coordinate of the top-left corner of the interactor relative to its window...
Definition: glabel.cpp:316
~GLabel() override
Frees memory allocated internally by the label.
Definition: glabel.cpp:68