本文整理汇总了C++中QLCDNumber::setFixedSize方法的典型用法代码示例。如果您正苦于以下问题:C++ QLCDNumber::setFixedSize方法的具体用法?C++ QLCDNumber::setFixedSize怎么用?C++ QLCDNumber::setFixedSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLCDNumber
的用法示例。
在下文中一共展示了QLCDNumber::setFixedSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QMainWindow *window = new QMainWindow();
window->setWindowTitle(QString::fromUtf8("QLCDnumber Show Milliseconds Time"));
window->resize(800, 250);
QWidget* centralWidget = new QWidget();
QVBoxLayout* verticalLayout = new QVBoxLayout();
centralWidget->setLayout(verticalLayout);
QLCDNumber *number = new QLCDNumber();
verticalLayout->addWidget(number);
number->setFixedSize(-800, 245);
number->setDigitCount(12);
number->display(QTime::currentTime().toString(QString("hh:mm:ss.zzz")));
window->setCentralWidget(centralWidget);
window->show();
return app.exec();
}
示例2: QMainWindow
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
QMenu *file;
QMenu *edit;
QMenu *effect;
QMenu *tools;
QMenu *help;
QAction *newa = new QAction(tr("&New"), this);
QAction *open = new QAction(tr("&Open"), this);
QAction *save = new QAction(tr("&Save"), this);
QAction *saveas = new QAction(tr("&Save as"), this);
QAction *import = new QAction(tr("&Import sample"), this);
QAction *quit = new QAction(tr("&Quit"), this);
QAction *play = new QAction(tr("&Play"), this);
QAction *stop = new QAction(tr("&Stop"), this);
QAction *pause = new QAction(tr("&Pause"), this);
QAction *record= new QAction(tr("&Record"), this);
QAction *zoomin = new QAction(tr("Zoom in"), this);
QAction *zoomout = new QAction(tr("Zoom out"), this);
QAction *settings = new QAction(tr("&Settings"), this);
QToolBar *toolbar = addToolBar("Main ToolBar");
QLCDNumber *lcd = new QLCDNumber();
QLabel * play_v = new QLabel(), * rec_v = new QLabel();
QSlider * play_slider = new QSlider(Qt::Horizontal), * rec_slider = new QSlider(Qt::Horizontal);
wave = new Wave();
fileName = "";
changed = false;
newa->setIcon(QIcon::fromTheme("document-new"));
newa->setShortcut(tr("CTRL+N"));
open->setIcon(QIcon::fromTheme("document-open"));
open->setShortcut(tr("CTRL+O"));
save->setIcon(QIcon::fromTheme("document-save"));
save->setShortcut(tr("CTRL+S"));
saveas->setIcon(QIcon::fromTheme("document-save-as"));
import->setIcon(QIcon::fromTheme("audio-x-generic"));
zoomin->setIcon(QIcon::fromTheme("zoom-in"));
zoomin->setShortcut(tr("CTRL+Up"));
zoomout->setIcon(QIcon::fromTheme("zoom-out"));
zoomout->setShortcut(tr("CTRL+Down"));
play->setIcon(QIcon::fromTheme("media-playback-start"));
play->setShortcut(tr("Space"));
play->setCheckable(true);
stop->setIcon(QIcon::fromTheme("media-playback-stop"));
pause->setIcon(QIcon::fromTheme("media-playback-pause"));
record->setIcon(QIcon::fromTheme("media-record"));
record->setShortcut(tr("Ctrl+Space"));
record->setCheckable(true);
quit->setIcon(QIcon::fromTheme("application-exit"));
quit->setShortcut(tr("CTRL+Q"));
lcd->setDigitCount(8);
lcd->display("00:00:00");
lcd->setStyleSheet("background: black; color: #00FF00");
lcd->setFixedSize(100, 30);
play_v->setText(tr("Playback volume:"));
rec_v->setText(tr("Record volume:"));
play_slider->setMaximumWidth(50);
play_slider->setRange(0, 100);
rec_slider->setMaximumWidth(50);
rec_slider->setRange(0, 100);
file = menuBar()->addMenu(tr("&File"));
file->addAction(newa);
file->addAction(open);
file->addAction(save);
file->addAction(saveas);
file->addSeparator();
file->addAction(import);
file->addSeparator();
file->addAction(quit);
edit = menuBar()->addMenu(tr("&Edit"));
effect = menuBar()->addMenu(tr("&Effects"));
tools = menuBar()->addMenu(tr("&Tools"));
settings->setIcon(QIcon::fromTheme("multimedia-volume-control"));
tools->addAction(settings);
help = menuBar()->addMenu(tr("&Help"));
toolbar->addAction(newa);
toolbar->addAction(open);
toolbar->addAction(save);
toolbar->addSeparator();
toolbar->addAction(import);
toolbar->addAction(zoomin);
toolbar->addAction(zoomout);
toolbar->addSeparator();
toolbar->addAction(stop);
toolbar->addAction(pause);
toolbar->addAction(play);
toolbar->addAction(record);
toolbar->addSeparator();
toolbar->addWidget(play_v);
toolbar->addWidget(play_slider);
toolbar->addWidget(rec_v);
toolbar->addWidget(rec_slider);
toolbar->addWidget(lcd);
connect(newa, SIGNAL(triggered()), this, SLOT(newFile()));
connect(open, SIGNAL(triggered()), this, SLOT(openFile()));
connect(save, SIGNAL(triggered()), this, SLOT(saveFile()));
connect(saveas, SIGNAL(triggered()), this, SLOT(saveFileAs()));
connect(quit, SIGNAL(triggered()), qApp, SLOT(quit()));
connect(zoomin, SIGNAL(triggered()), this, SLOT(zoomIn()));
//.........这里部分代码省略.........