本文整理汇总了C++中QWindow::setTitle方法的典型用法代码示例。如果您正苦于以下问题:C++ QWindow::setTitle方法的具体用法?C++ QWindow::setTitle怎么用?C++ QWindow::setTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWindow
的用法示例。
在下文中一共展示了QWindow::setTitle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: currentMediaChanged
MediaPlayer::MediaPlayer(QObject *parent)
: QObject(parent)
, _playlist(nullptr)
, _state(QMediaPlayer::StoppedState)
, _localPlayer(new QtAV::AVPlayer(this))
, _remotePlayer(nullptr)
, _stopAfterCurrent(false)
{
connect(_localPlayer, &QtAV::AVPlayer::stopped, this, [=]() {
this->setState(QMediaPlayer::StoppedState);
});
connect(_localPlayer, &QtAV::AVPlayer::loaded, this, [=]() {
_localPlayer->audio()->setVolume(Settings::instance()->volume());
emit currentMediaChanged(_localPlayer->file());
this->setState(QMediaPlayer::PlayingState);
});
connect(_localPlayer, &QtAV::AVPlayer::paused, this, [=](bool) {
this->setState(QMediaPlayer::PausedState);
});
connect(_localPlayer, &QtAV::AVPlayer::positionChanged, this, [=](qint64 pos) {
if (_state == QMediaPlayer::PlayingState) {
emit positionChanged(pos, _localPlayer->duration());
}
});
_localPlayer->audio()->setVolume(Settings::instance()->volume());
connect(this, &MediaPlayer::currentMediaChanged, this, [=] (const QString &uri) {
QWindow *w = QGuiApplication::topLevelWindows().first();
TrackDAO t = SqlDatabase().selectTrackByURI(uri);
if (t.artist().isEmpty()) {
w->setTitle(t.title() + " - Miam Player");
} else {
w->setTitle(t.title() + " (" + t.artist() + ") - Miam Player");
}
});
// Link core multimedia actions
connect(this, &MediaPlayer::mediaStatusChanged, this, [=] (QMediaPlayer::MediaStatus status) {
if (_state != QMediaPlayer::StoppedState && status == QMediaPlayer::EndOfMedia) {
if (_stopAfterCurrent) {
stop();
_stopAfterCurrent = false;
} else {
skipForward();
}
}
});
}
示例2: firstWindowTitle
void tst_QGuiApplication::firstWindowTitle()
{
int argc = 3;
char *argv[] = { const_cast<char*>("tst_qguiapplication"), const_cast<char*>("-qwindowtitle"), const_cast<char*>("User Title") };
QGuiApplication app(argc, argv);
QWindow window;
window.setTitle("Application Title");
window.show();
QCOMPARE(window.title(), QString("User Title"));
}