本文整理汇总了C++中QLabel::setWindowTitle方法的典型用法代码示例。如果您正苦于以下问题:C++ QLabel::setWindowTitle方法的具体用法?C++ QLabel::setWindowTitle怎么用?C++ QLabel::setWindowTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLabel
的用法示例。
在下文中一共展示了QLabel::setWindowTitle方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: help
//Slot for the game help button
void Board::help()
{
QLabel *instructions = new QLabel(" Game rules and instructions:\n Point the mouse curser in the direction you wish to shoot the bubble\n If the bubble forms a group with 3 or more same colour bubbles,\n they will be deleted and you will recieve points.");
instructions->setWindowTitle("Bubble Shooter - Help"); //writes instruction and displayes them
instructions->setFixedSize(400,200);
instructions->show();
qDebug("clicked Help");
}
示例2: pokazPomoc
void CGraphicMonth::pokazPomoc()
{ QFont font;
font.setPointSize(mainFontSize+1);
QLabel* pomocLabel = new QLabel(QString("Kalendarz pozwala na wyswietlanie oraz zmianę aktualnego miesiaca.\nPozwala również na dodawanie/usuwanie dni świątecznych poprzez kliknięcie w dany dzień."),this);
pomocLabel->setFont(font);
pomocLabel->setWindowTitle(QString("Pomoc kalendarza."));
pomocLabel->setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::Dialog);
pomocLabel->show();
}
示例3: activated
void CmdTestRedirectPaint::activated(int iMsg)
{
QCalendarWidget* cal = new QCalendarWidget();
QLabel* label = new QLabel();
QPainter::setRedirected(cal,label);
cal->setWindowTitle(QString::fromAscii("QCalendarWidget"));
cal->show();
label->show();
label->setWindowTitle(QString::fromAscii("QLabel"));
}
示例4: displayData
void displayData(const ComplexVector<T> &data, ImageSize size, const QString& title)
{
std::vector<T> dataValue;
int n0 = size.x;
int n1 = size.y;
int n2 = size.z;
if (n2 < 2) n2 = 2;
int nImages = 4;
int start = (n0 * n1) * (n2 / 2 - 3);
int end = (n0 * n1) * (n2 / 2 - 3 + nImages);
for (auto it = data.begin() + start; it < data.begin() + end; it++) {
float value = std::abs(*it);
dataValue.push_back(value);
}
float max = *std::max_element(dataValue.begin(), dataValue.end());
float min = *std::min_element(dataValue.begin(), dataValue.end());
QImage dataImage(n1 * nImages, n0, QImage::Format_Indexed8);
for (int i = 0; i < 256; i++) {
dataImage.setColor(i, qRgb(i, i, i));
}
int i = 0;
for (int y = 0; y < n0; y++) {
auto imageLine = dataImage.scanLine(y);
i = y * n1;
for (int j = 0; j < nImages; j++)
{
for (int x = j * n0; x < j * n0 + n1; x++)
{
Q_ASSERT(i < dataValue.size());
uint idx;
if (max == min)
idx = 127;
else
idx = (dataValue[i] - min) / (max - min) * 255;
imageLine[x] = idx;
i++;
}
i += n0 * (n1 - 1);
}
}
QPixmap pixmap = QPixmap::fromImage(dataImage);
QLabel *imgWnd = new QLabel("Image Window");
imgWnd->setWindowTitle(title);
imgWnd->setPixmap(pixmap);
imgWnd->show();
}
示例5: main
int main(int argc, char *argv[])
{
Application app(argc, argv);
QEventLoop loop;
auto s(std::async(std::launch::async, [&loop]{ Datum::Solve solve(Datum::solve()); if (loop.isRunning()) { loop.quit(); } return std::move(solve); }));
QLabel splash;
splash.setMovie(new QMovie(([](){
static const QString basePath(":/splash/busy/");
const QStringList files(QDir(basePath).entryList(QStringList() << "*.gif"));
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_int_distribution<> d(0,files.size() - 1);
const QString& result(files.at(d(gen)));
return basePath + result;
})()));
splash.movie()->start();
splash.show();
splash.setWindowTitle("computing. . .");
if (s.wait_until(std::chrono::system_clock::now()) != std::future_status::ready) {
loop.exec();
}
splash.hide();
app.showBarley();
Datum::Solve solve(s.get());
Datum d;
while (!solve.empty()) {
Application::showDatum(d);
d = d.realize(solve.top());
solve.pop();
}
Application::showDatum(d, false);
app.quit();
return 0;
}
示例6: funS
void MainWindow::funS()
{
QLabel* l = new QLabel;
l->setWindowTitle("Fun");
l->setFixedSize(765, 500);
QObject::connect( this, SIGNAL( closeSignal() ), l, SLOT( close() ) );
QRect rect(l->contentsRect());
QPainter painter;
QImage resultImage(rect.size(), QImage::Format_ARGB32_Premultiplied);
painter.begin(&resultImage);
painter.setCompositionMode(QPainter::CompositionMode_SourceOver);
painter.eraseRect(rect);
painter.drawImage(rect, resultImage);
painter.end();
painter.begin(&resultImage);
painter.setCompositionMode(QPainter::CompositionMode_Darken);
for(int i = 0; i < 765; i++)
{
if(i<256)
painter.setPen(QPen(QColor(255, i, 0), 1));
else if(i < 512)
painter.setPen(QPen(QColor(511-i, 255, i-256), 1));
else
painter.setPen(QPen(QColor(i-512, 765-i, 255), 1));
painter.drawLine(i, 0, i, 500);
}
painter.setCompositionMode(QPainter::CompositionMode_SourceOver);
painter.drawImage(rect, resultImage);
painter.end();
l->setPixmap(QPixmap::fromImage(resultImage));
l->show();
QObject::connect( this, SIGNAL( closeSignal() ), l, SLOT( close() ) );
}
示例7: displayData
void displayData(int n0, int n1, const complexVector& data, const QString& title)
{
QVector<float> dataValue;
float max = 0;
float min = FLT_MAX;
for (auto cValue : data) {
float value = std::abs(cValue);
if (value > max) max = value;
if (value < min) min = value;
dataValue << value;
}
QImage dataImage(n1, n0, QImage::Format_Indexed8);
for (int i = 0; i < 256; i++) {
dataImage.setColor(i, qRgb(i, i, i));
}
int i = 0;
for (int y = 0; y < n0; y++) {
auto imageLine = dataImage.scanLine(y);
for (int x = 0; x < n1; x++) {
uint idx;
if (max == min)
idx = 127;
else
idx = (dataValue[i] - min) / (max - min) * 255;
imageLine[x] = idx;
i++;
}
}
QPixmap pixmap = QPixmap::fromImage(dataImage);
QLabel *imgWnd = new QLabel("Image Window");
imgWnd->setWindowTitle(title);
imgWnd->setPixmap(pixmap);
imgWnd->show();
}
示例8: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QPalette p;
p.setColor(QPalette::Background, QColor("#97CBFF"));
a.setPalette(p);
//a.setAutoFillBackground(true);
QLabel *window = new QLabel();
window->setWindowTitle(TEXT_WINDOW_TITLE);
QLabel *horCoordinate = new QLabel();
QPixmap hCoord(PATH_HCOORD_IMG);
horCoordinate->setPixmap(hCoord);
horCoordinate->setMinimumSize(SIZE_COORDINATE_L, SIZE_COORDINATE_W);
QLabel *verCoordinate = new QLabel();
QPixmap vCoord(PATH_VCOORD_IMG);
verCoordinate->setPixmap(vCoord);
verCoordinate->setMinimumSize(SIZE_COORDINATE_W, SIZE_COORDINATE_L);
Chessboard *chessboard = new Chessboard();
QPixmap img(PATH_CHESSBORAD_IMG);
chessboard->setPixmap(img.scaled(SIZE_CHESSBOARD, SIZE_CHESSBOARD));
chessboard->setMinimumSize(SIZE_CHESSBOARD, SIZE_CHESSBOARD);
QTextCodec *TradChineseCodec = QTextCodec::codecForName("Big5-ETen");
QLabel *chessboardReadme = new QLabel(TradChineseCodec->toUnicode(
"<center> <b>黑方</b> 滑鼠左鍵 |<b> 白方</b> 滑鼠右鍵 |<b> 清空</b> 滑鼠中鍵 </center>"));
chessboardReadme->setAlignment(Qt::AlignHCenter);
QLabel *funcReadme = new QLabel(TradChineseCodec->toUnicode(" <br> <br> <br> <br> <br><br> <br> <br> <br>"));
QPushButton *clearBoard = new QPushButton(TradChineseCodec->toUnicode("清空棋盤"));
QObject::connect(clearBoard, SIGNAL(clicked()), chessboard, SLOT(cleanChessboard()));
QPushButton *readBoardData = new QPushButton(TradChineseCodec->toUnicode("讀取已存棋盤"));
QObject::connect(readBoardData, SIGNAL(clicked()), chessboard, SLOT(readFromTxt()));
QGridLayout *buttonLayout = new QGridLayout();
buttonLayout->addWidget(readBoardData, 0, 0);
buttonLayout->addWidget(clearBoard, 0, 1);
QGridLayout *wholeChessboard = new QGridLayout;
wholeChessboard->addWidget(horCoordinate, 0, 1);
wholeChessboard->addWidget(verCoordinate, 1, 0);
wholeChessboard->addWidget(chessboard, 1, 1);
wholeChessboard->addWidget(chessboardReadme, 2, 0, 1, 2);
wholeChessboard->addLayout(buttonLayout, 3, 0, 1, 2);
wholeChessboard->addWidget(funcReadme, 4, 0, 1, 2);
wholeChessboard->setMargin(20);
FuncSet1 *findThreat = new FuncSet1();
findThreat->setMinimumSize(SIZE_FUNC_W, SIZE_FUNC_H2);
findThreat->setBrd(&(chessboard->boardData));
FuncSet2 *threatSpaceSearch = new FuncSet2();
threatSpaceSearch->setMinimumSize(SIZE_FUNC_W, SIZE_FUNC_H1);
threatSpaceSearch->setBrd(&(chessboard->boardData));
FuncSet3 *availableMove = new FuncSet3();
availableMove->setMinimumSize(SIZE_FUNC_W, SIZE_FUNC_H2);
availableMove->setBrd(&(chessboard->boardData));
FuncSet4 *proofNumberSearch = new FuncSet4();
proofNumberSearch->setMinimumSize(SIZE_FUNC_W, SIZE_FUNC_H1);
proofNumberSearch->setBrd(&(chessboard->boardData));
QGridLayout *wholeApp = new QGridLayout();
wholeApp->addLayout(wholeChessboard, 0, 0, 3, 1);
wholeApp->addWidget(availableMove, 0, 1);
wholeApp->addWidget(findThreat, 1, 1);
wholeApp->addWidget(threatSpaceSearch, 2, 1);
wholeApp->addWidget(proofNumberSearch, 0, 2, 3, 1);
wholeApp->setSpacing(15);
QObject::connect(chessboard, SIGNAL(changeFuncsTurn(int)), availableMove, SLOT(changeTurn(int)));
QObject::connect(chessboard, SIGNAL(changeFuncsTurn(int)), findThreat, SLOT(changeTurn(int)));
QObject::connect(chessboard, SIGNAL(changeFuncsTurn(int)), threatSpaceSearch, SLOT(changeTurn(int)));
QObject::connect(chessboard, SIGNAL(changeFuncsTurn(int)), proofNumberSearch, SLOT(changeTurn(int)));
//wholeChessboard->addWidget(test, 4, 0, 1, 2);
/*Paper *ya = new Paper();
wholeApp->addWidget(ya, 2,2);
BoardData orig;
orig.printBoard(ya);
orig.set(0,0,BLACK);
orig.set(0,1,WHITE);
orig.printBoard(ya);
BoardData *tmp = new BoardData(&orig);
tmp->set(1,1,BLACK);
tmp->printBoard(ya);
orig.printBoard(ya);*/
window->setLayout(wholeApp);
// 把其他method也寫進去
//.........这里部分代码省略.........
示例9: show
void Utils::show(QString title, QImage* img){
QLabel label;
label.setPixmap(QPixmap::fromImage(*img));
label.setWindowTitle(title);
label.show();
}