statusbar.cc

来自「c++的guiQt做的开发」· CC 代码 · 共 80 行

CC
80
字号
/** @file StatusBar - class representing Status bar @author Martin Petricek*/#include "statusbar.h"#include <QColor>#include <qlabel.h>#include <qtimer.h>#include <qlayout.h>namespace gui {using namespace std;/** Constructor of StatusBar @param parent Parent window of this dialog*/StatusBar::StatusBar(QWidget *parent/*=0*/) : QStatusBar(parent) { //Seelction coords coords=new QLabel(" ",this); coords->setMargin(2); coords->setTextFormat(Qt::PlainText); addPermanentWidget(coords,0); //Add informational label to right info=new QLabel(" ",this); info->setMargin(2); info->setTextFormat(Qt::PlainText); addPermanentWidget(info,0); //Add label to right with zoom level zoom=new QLabel(" ",this); zoom->setMargin(2); zoom->setTextFormat(Qt::PlainText); addPermanentWidget(zoom,0); //Add message label to left msgLabel=new QLabel(" ",this); msgLabel->setMargin(2);// msgLabel->setWordWrap(true) msgLabel->setTextFormat(Qt::PlainText); addWidget(msgLabel,8);}/** Set text shown in informational label @param theMessage new text*/void StatusBar::receiveInfoText(const QString &theMessage) { info->setText(" "+theMessage+" ");}/** Set text shown as zoom level @param theMessage new text*/void StatusBar::receiveZoomText(const QString &theMessage) { zoom->setText(" "+theMessage+" ");}/** Set text shown as coords @param theMessage new text*/void StatusBar::receiveCoordsText(const QString &theMessage) { coords->setText(" "+theMessage+" ");}/** Set text shown in message label @param theMessage new text*/void StatusBar::message(const QString &theMessage) { msgLabel->setText(theMessage);}/** default destructor */StatusBar::~StatusBar() {}} // namespace gui

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?