CDPBaseLostRoutingsLabel Class
The Lost Routings Label is a widget for showing info about routings which are not connected. More...
Header: | #include <CDPBaseWidgets/CDPBaseLostRoutingsLabel.h> |
Inherits: | CDPBaseLabel |
Public Types
enum | LostRoutingDisplay { LastRouting, FirstRouting, Count } |
Properties
- routingDisplay : LostRoutingDisplay
- showNextItemOnClick : bool
- textNoLostRoutings : QString
- 21 properties inherited from CDPBaseLabel
Public Functions
CDPBaseLostRoutingsLabel(QWidget *parent = 0) | |
virtual | ~CDPBaseLostRoutingsLabel() |
LostRoutingDisplay | routingDisplay() |
void | setRoutingDisplay(LostRoutingDisplay display) |
void | setShowNextItemOnClick(bool enable) |
void | setTextNoLostRoutings(const QString &text) |
bool | showNextItemOnClick() |
QString | textNoLostRoutings() |
Reimplemented Public Functions
virtual void | setIQtCDPPointer(IQtCDP *pIQtCDP) |
- 29 public functions inherited from CDPBaseLabel
- 3 public functions inherited from StateChanger
- 17 public functions inherited from CDPBaseCom
- 4 public functions inherited from CDPBaseControlVisible
Public Slots
void | setLostRoutings(int routings) |
void | showNextItem() |
- 21 public slots inherited from CDPBaseLabel
Signals
void | lostRoutings() |
void | lostRoutingsEmpty() |
- 3 signals inherited from CDPBaseLabel
Protected Functions
void | updateDisplay() |
Reimplemented Protected Functions
virtual void | mousePressEvent(QMouseEvent *e) |
- 8 protected functions inherited from CDPBaseLabel
- 4 protected functions inherited from CDPBaseCom
- 1 protected function inherited from CDPBaseControlVisible
Additional Inherited Members
- 2 static public members inherited from CDPBaseCom
Detailed Description
The Lost Routings Label is a widget for showing info about routings which are not connected.
The label will show the number of unconnected routings or the actual routing text based on configuration. When there are multiple lost routings, clicking the label will show the next lost routing when configured to do so.
Typical usage would be to place it in a message panel on the top of the main window and make it show in the event of lost routings. The following example demonstrates how to configure the various elements of such a panel:
- Starting out with an empty main window, drag in a CDPBaseContainer at the top of the page and an ordinary Widget at the bottom. Place the widgets in a vertical layout. Set layout margins to 0 and give the CDPBaseContainer a max height of about 40 pixels.
- The bottom widget is where you will design your application and the container where we will create our lost routings message panel.
- Drag two instances of the CDPBaseLostRoutingsLabel into the message panel. We'll configure the first one to show the number of lost routings by setting routingDisplay to Count. The second one is configured to show lost routings in text by selecting something other than Count in routingDisplay.
- Next, we'll drag in a CDPBaseLabel to function as a close/hide button on the right side of the panel. Set its text property to X, and set minimumSize and maximumSize to 40 to add extra space around the button.
- Finally, well add a horizontal layout to the panel and make the lost routings text expanding by selecting Expanding as the Horizontal Policy (located under the sizePolicy property group). You should also adjust the layout margins to make the panel look good with the rest of teh gui.
- To make the panel hide and show when there are lost routings, we will use qt signals and slots. Enter signals and slots mode by pressing F4 and make the following connections by drag and drop. Connect routing label signal lostRoutings to message panel showWidget. Similarily, connect lostRoutingsEmpty to hideWidget to make the message panel hide when there are no lost routings. Also, connect the clicked signal from our X label to hideWidget to enable it to hide the panel by click. It might be a good idea to also add a button in gui for showing the panel.
- To make the panel look more like an actual message panel, you can configure it with the the borderPixmap property set to, :/themes/cdp_light/backgrounds/bgMsgBox.svg, and select widgetStyle number 2.
- Some users also prefer to add a border around the lost routings number. This can be done by adding it to a QFrame with the following styling:
QFrame
{border: 1px solid gray; border-radius: 12px;}Note: Remember to set visible to false on the CDPBaseContainer unless you want the panel to show initially. Use the object inspector to show it again after making it invisible.
Member Type Documentation
enum CDPBaseLostRoutingsLabel::LostRoutingDisplay
This enum type specifies what to display:
Constant | Value | Description |
---|---|---|
CDPBaseLostRoutingsLabel::LastRouting | 0 | Display the last lost routing. |
CDPBaseLostRoutingsLabel::FirstRouting | 1 | Display the first lost routing. |
CDPBaseLostRoutingsLabel::Count | 2 | Display number of lost routings. |
Property Documentation
routingDisplay : LostRoutingDisplay
This property holds what to display on the label.
Access functions:
LostRoutingDisplay | routingDisplay() |
void | setRoutingDisplay(LostRoutingDisplay display) |
showNextItemOnClick : bool
This property holds whether or not to show next item on the label (when having multiple lost routings).
Access functions:
bool | showNextItemOnClick() |
void | setShowNextItemOnClick(bool enable) |
textNoLostRoutings : QString
This property holds the text to display on the label if there are no lost routings and the label is configure to show routing text.
Access functions:
QString | textNoLostRoutings() |
void | setTextNoLostRoutings(const QString &text) |
See also routingDisplay.
Member Function Documentation
CDPBaseLostRoutingsLabel::CDPBaseLostRoutingsLabel(QWidget *parent = 0)
Default constructs an instance of CDPBaseLostRoutingsLabel.
[virtual]
CDPBaseLostRoutingsLabel::~CDPBaseLostRoutingsLabel()
Destroys the instance of CDPBaseLostRoutingsLabel. The destructor is virtual.
[signal]
void CDPBaseLostRoutingsLabel::lostRoutings()
This signal is emitted when there are no more lost routings to show. The signal is often used to show the message panel it is in. Thus, only showing the panel when there is something to display.
See also setLostRoutings().
[signal]
void CDPBaseLostRoutingsLabel::lostRoutingsEmpty()
This signal is emitted when there are no more lost routings to show. The signal is often used to hide the message panel where the label is located. Thus, only showing the panel when there is something to display.
[virtual protected]
void CDPBaseLostRoutingsLabel::mousePressEvent(QMouseEvent *e)
[virtual]
void CDPBaseLostRoutingsLabel::setIQtCDPPointer(IQtCDP *pIQtCDP)
[slot]
void CDPBaseLostRoutingsLabel::setLostRoutings(int routings)
This slot is executed from the interface when the number of lost routings are changed.
Note: Shouldn't be set manually by the user.
See also lostRoutings().
[slot]
void CDPBaseLostRoutingsLabel::showNextItem()
This slot can be executed to show the next lost routing element on the label (requires that there are multiple lost routings).
[protected]
void CDPBaseLostRoutingsLabel::updateDisplay()
Get started with CDP Studio today
Let us help you take your great ideas and turn them into the products your customer will love.