当前位置: 首页>>代码示例>>C++>>正文


C++ QStatusBar::insertPermanentWidget方法代码示例

本文整理汇总了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);
}
开发者ID:AltarBeastiful,项目名称:qt-creator,代码行数:32,代码来源:statusbarmanager.cpp

示例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();
}
开发者ID:flaviotordini,项目名称:minitube,代码行数:47,代码来源:mediaview.cpp

示例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;
}
开发者ID:Wushaowei001,项目名称:NAF,代码行数:19,代码来源:QtlStatusBar.cpp


注:本文中的QStatusBar::insertPermanentWidget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。