本文整理汇总了C++中QStatusBar::insertPermanentWidget方法的典型用法代码示例。如果您正苦于以下问题:C++ QStatusBar::insertPermanentWidget方法的具体用法?C++ QStatusBar::insertPermanentWidget怎么用?C++ QStatusBar::insertPermanentWidget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QStatusBar
的用法示例。
在下文中一共展示了QStatusBar::insertPermanentWidget方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QObject
StatusBarManager::StatusBarManager(MainWindow *mainWnd)
: QObject(mainWnd),
m_mainWnd(mainWnd)
{
QStatusBar *bar = m_mainWnd->statusBar();
m_splitter = new NonResizingSplitter(bar);
bar->insertPermanentWidget(0, m_splitter, 10);
m_splitter->setChildrenCollapsible(false);
// first
QWidget *w = createWidget(m_splitter);
w->layout()->setContentsMargins(0, 0, 3, 0);
m_splitter->addWidget(w);
m_statusBarWidgets.append(w);
QWidget *w2 = createWidget(m_splitter);
w2->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
m_splitter->addWidget(w2);
// second
w = createWidget(w2);
w2->layout()->addWidget(w);
m_statusBarWidgets.append(w);
// third
w = createWidget(w2);
w2->layout()->addWidget(w);
m_statusBarWidgets.append(w);
static_cast<QBoxLayout *>(w2->layout())->addStretch(1);
QWidget *rightCornerWidget = createWidget(bar);
bar->insertPermanentWidget(1, rightCornerWidget);
m_statusBarWidgets.append(rightCornerWidget);
}
示例2: snapshot
void MediaView::snapshot() {
qint64 currentTime = media->position() / 1000;
QObject *context = new QObject();
connect(media, &Media::snapshotReady, context,
[this, currentTime, context](const QImage &image) {
context->deleteLater();
if (image.isNull()) {
qWarning() << "Null snapshot";
return;
}
QPixmap pixmap = QPixmap::fromImage(image.scaled(
videoWidget->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation));
videoAreaWidget->showSnapshotPreview(pixmap);
Video *video = playlistModel->activeVideo();
if (!video) return;
QString location = SnapshotSettings::getCurrentLocation();
QDir dir(location);
if (!dir.exists()) dir.mkpath(location);
QString basename = video->getTitle();
QString format = video->getDuration() > 3600 ? "h_mm_ss" : "m_ss";
basename += " (" + QTime(0, 0, 0).addSecs(currentTime).toString(format) + ")";
basename = DataUtils::stringToFilename(basename);
QString filename = location + "/" + basename + ".png";
qDebug() << filename;
image.save(filename, "PNG");
if (snapshotSettings) delete snapshotSettings;
snapshotSettings = new SnapshotSettings(videoWidget);
snapshotSettings->setSnapshot(pixmap, filename);
QStatusBar *statusBar = MainWindow::instance()->statusBar();
#ifdef APP_EXTRA
Extra::fadeInWidget(statusBar, statusBar);
#endif
statusBar->insertPermanentWidget(0, snapshotSettings);
snapshotSettings->show();
MainWindow::instance()->setStatusBarVisibility(true);
}
#endif
);
media->snapshot();
}
示例3: insertPermanentWidget
int StatusBar::insertPermanentWidget(lua_State * L) // ( int index, QWidget * widget, int stretch = 0 )
{
QStatusBar* obj = ObjectHelper<QStatusBar>::check( L, 1);
QWidget* widget = ObjectHelper<QWidget>::check( L, 2);
int stretch = 0;
if (Util::isNum( L, 4 ) )
{
if ( Util::toInt( L, 4 ) < 0 )
{
Util::error( L, "Starting No can not be negative" );
}
else
{
stretch = Util::toInt( L, 4 );
}
}
Util::push( L, obj->insertPermanentWidget( Util::toInt( L, 2 ), widget, stretch ) );
return 1;
}