• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ QPixmap函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中QPixmap函数的典型用法代码示例。如果您正苦于以下问题:C++ QPixmap函数的具体用法?C++ QPixmap怎么用?C++ QPixmap使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了QPixmap函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char *argv[])
{
    bool hasTouchScreen = QFile::exists("/sys/devices/platform/rpi_ft5406");

    // Unless we have a touch screen, wait for keyboard to appear before displaying anything
    if (!hasTouchScreen)
        KeyDetection::waitForKeyboard();

    int rev = readBoardRevision();

    qDebug() << "Board revision is " << rev;

    int gpioChannel;

    if (rev == 2 || rev == 3)
        gpioChannel = 0;
    else
        gpioChannel = 2;

    QApplication a(argc, argv);
    RightButtonFilter rbf;
    LongPressHandler lph;
    GpioInput gpio(gpioChannel);

    bool runinstaller = false;
    bool gpio_trigger = false;
    bool keyboard_trigger = true;
    bool force_trigger = false;

    QString defaultLang = "en";
    QString defaultKeyboard = "gb";
    QString defaultDisplay = "0";
    QString defaultPartition = "800";

    // Process command-line arguments
    for (int i=1; i<argc; i++)
    {
        // Flag to indicate first boot
        if (strcmp(argv[i], "-runinstaller") == 0)
            runinstaller = true;
        // Enables use of GPIO 3 to force NOOBS to launch by pulling low
        else if (strcmp(argv[i], "-gpiotriggerenable") == 0)
            gpio_trigger = true;
        // Disables use of keyboard to trigger recovery GUI
        else if (strcmp(argv[i], "-keyboardtriggerdisable") == 0)
            keyboard_trigger = false;
        // Forces display of recovery GUI every time
        else if (strcmp(argv[i], "-forcetrigger") == 0)
            force_trigger = true;
        // Allow default language to be specified in commandline
        else if (strcmp(argv[i], "-lang") == 0)
        {
            if (argc > i+1)
                defaultLang = argv[i+1];
        }
        // Allow default keyboard layout to be specified in commandline
        else if (strcmp(argv[i], "-kbdlayout") == 0)
        {
            if (argc > i+1)
                defaultKeyboard = argv[i+1];
        }
        // Allow default display mode to be specified in commandline
        else if (strcmp(argv[i], "-dispmode") == 0)
        {
            if (argc > i+1)
                defaultDisplay = --argv[i+1];
        }
        // Allow default boot partition to be specified in commandline
        else if (strcmp(argv[i], "-partition") == 0)
        {
            if (argc > i+1)
                defaultPartition = argv[i+1];
        }
    }

    // Intercept right mouse clicks sent to the title bar
    a.installEventFilter(&rbf);

    // Treat long holds as double-clicks
    if (hasTouchScreen)
        a.installEventFilter(&lph);

#ifdef Q_WS_QWS
    QWSServer::setCursorVisible(false);
#endif

    QDir settingsdir;
    settingsdir.mkdir("/settings");

    // Set wallpaper and icon, if we have resource files for that
    if (QFile::exists(":/icons/raspberry_icon.png"))
        a.setWindowIcon(QIcon(":/icons/raspberry_icon.png"));

#ifdef Q_WS_QWS
    QWSServer::setBackground(BACKGROUND_COLOR);
#endif
    QSplashScreen *splash = new QSplashScreen(QPixmap(":/wallpaper.png"));
    splash->show();
    QApplication::processEvents();

//.........这里部分代码省略.........
开发者ID:XECDesign,项目名称:noobs,代码行数:101,代码来源:main.cpp


示例2: category

void SystemActions::generateActions(const std::vector<int> & actions)
{
    category()->setText(QCoreApplication::tr("System"));
    actions_.clear();

    std::vector<int> all = actions;
    if (all.size() <= 0)
    {
        all.push_back(ROTATE_SCREEN);
        all.push_back(SCREEN_UPDATE_TYPE);
        all.push_back(MUSIC);

#ifdef BUILD_WITH_TFT
        all.push_back(BACKLIGHT_BRIGHTNESS);
#endif
        if (sys::isIRTouch())
        {
            all.push_back(SYSTEM_VOLUME);
        }
        all.push_back(RETURN_TO_LIBRARY);
    }

    for(int i = 0; i < static_cast<int>(all.size()); ++i)
    {
        switch (all[i])
        {
        case ROTATE_SCREEN:
        {
            shared_ptr<QAction> rotate(new QAction(exclusiveGroup()));
            rotate->setCheckable(true);
            rotate->setText(QCoreApplication::tr("Rotate Screen"));
            rotate->setIcon(QIcon(QPixmap(":/images/screen_rotation.png")));
            rotate->setData(ROTATE_SCREEN);
            actions_.push_back(rotate);
            break;
        }
        case SCREEN_UPDATE_TYPE:
        {
            // Screen update type.
            shared_ptr<QAction> screen(new QAction(exclusiveGroup()));
            screen->setCheckable(true);
            if (onyx::screen::instance().defaultWaveform() == onyx::screen::ScreenProxy::GC)
            {
                screen->setText(QCoreApplication::tr("Full Refresh Off"));
                screen->setIcon(QIcon(QPixmap(":/images/fast_update.png")));
            }
            else
            {
                screen->setText(QCoreApplication::tr("Full Refresh On"));
                screen->setIcon(QIcon(QPixmap(":/images/full_update.png")));
            }
            screen->setData(SCREEN_UPDATE_TYPE);
            actions_.push_back(screen);
            break;
        }
        case FULL_SCREEN:
        {
            shared_ptr<QAction> fullScreen(new QAction(exclusiveGroup()));
            fullScreen->setCheckable(true);
            fullScreen->setText(QCoreApplication::tr("Full Screen"));
            fullScreen->setIcon(QIcon(QPixmap(":/images/full_screen.png")));
            fullScreen->setData(FULL_SCREEN);
            actions_.push_back(fullScreen);
            break;
        }
        case EXIT_FULL_SCREEN:
        {
            shared_ptr<QAction> exitFullScreen(new QAction(exclusiveGroup()));
            exitFullScreen->setCheckable(true);
            exitFullScreen->setText(QCoreApplication::tr("Exit Full Screen"));
            exitFullScreen->setIcon(QIcon(QPixmap(
                                              ":/images/exit_full_screen.png")));
            exitFullScreen->setData(EXIT_FULL_SCREEN);
            actions_.push_back(exitFullScreen);
            break;
        }
        case MUSIC:
        {
            if (sys::SystemConfig::isMusicPlayerAvailable())
            {
                // Music.
                shared_ptr<QAction> music(new QAction(exclusiveGroup()));
                music->setCheckable(true);
                music->setText(QCoreApplication::tr("Music"));
                music->setIcon(QIcon(QPixmap(":/images/music.png")));
                music->setData(MUSIC);
                actions_.push_back(music);
            }
            break;
        }
        case SYSTEM_VOLUME:
        {
            // when music and tts both are disabled, do not show volume configure
            bool music_available = sys::SystemConfig::isMusicPlayerAvailable();
            bool disable_tts = qgetenv("DISABLE_TTS").toInt();
            if (!music_available && disable_tts)
            {
                continue;
            }

//.........这里部分代码省略.........
开发者ID:peter-x,项目名称:booxsdk,代码行数:101,代码来源:system_actions.cpp


示例3: main

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    qInstallMessageHandler(CockatriceLogger);
    if (app.arguments().contains("--debug-output"))
        Logger::getInstance().logToFile(true);

#ifdef Q_OS_WIN
    app.addLibraryPath(app.applicationDirPath() + "/plugins");
#endif

    QCoreApplication::setOrganizationName("Cockatrice");
    QCoreApplication::setOrganizationDomain("cockatrice.de");
    QCoreApplication::setApplicationName("Cockatrice");

#ifdef Q_OS_MAC
    qApp->setAttribute(Qt::AA_DontShowIconsInMenus, true);
#endif

#ifdef Q_OS_MAC
    translationPath = qApp->applicationDirPath() + "/../Resources/translations";
#elif defined(Q_OS_WIN)
    translationPath = qApp->applicationDirPath() + "/translations";
#else // linux
    translationPath = qApp->applicationDirPath() + "/../share/cockatrice/translations";
#endif

    rng = new RNG_SFMT;
    settingsCache = new SettingsCache;
    themeManager = new ThemeManager;
    soundEngine = new SoundEngine;
    db = new CardDatabase;

    qtTranslator = new QTranslator;
    translator = new QTranslator;
    installNewTranslator();

    qsrand(QDateTime::currentDateTime().toTime_t());
    qDebug("main(): starting main program");

    MainWindow ui;
    qDebug("main(): MainWindow constructor finished");

    ui.setWindowIcon(QPixmap("theme:cockatrice"));
    
    settingsCache->setClientID(generateClientID());

    ui.show();
    qDebug("main(): ui.show() finished");

    app.setAttribute(Qt::AA_UseHighDpiPixmaps);
    app.exec();

    qDebug("Event loop finished, terminating...");
    delete db;
    delete settingsCache;
    delete rng;
    PingPixmapGenerator::clear();
    CountryPixmapGenerator::clear();
    UserLevelPixmapGenerator::clear();

    return 0;
}
开发者ID:MarkyMarkMcDonald,项目名称:Cockatrice,代码行数:64,代码来源:main.cpp


示例4: QSplashScreen

SplashScreen::SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f, bool isTestNet) :
    QSplashScreen(pixmap, f)
{
    setAutoFillBackground(true);

    // set reference point, paddings
    int paddingRight            = 50;
    int paddingTop              = 50;
    int titleVersionVSpace      = 17;
    int titleCopyrightVSpace    = 40;

    float fontFactor            = 1.0;

    // define text to place
    QString titleText       = tr("Mrcoin Core");
    QString versionText     = QString("Version %1").arg(QString::fromStdString(FormatFullVersion()));
    QString copyrightText   = QChar(0xA9)+QString(" 2009-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The Mrcoin Core developers"));
    QString testnetAddText  = QString(tr("[testnet]")); // define text to place as single text object

    QString font            = "Arial";

    // load the bitmap for writing some text over it
    QPixmap newPixmap;
    if(isTestNet) {
        newPixmap     = QPixmap(":/images/splash_testnet");
    }
    else {
        newPixmap     = QPixmap(":/images/splash");
    }

    QPainter pixPaint(&newPixmap);
    pixPaint.setPen(QColor(100,100,100));

    // check font size and drawing with
    pixPaint.setFont(QFont(font, 33*fontFactor));
    QFontMetrics fm = pixPaint.fontMetrics();
    int titleTextWidth  = fm.width(titleText);
    if(titleTextWidth > 160) {
        // strange font rendering, Arial probably not found
        fontFactor = 0.75;
    }

    pixPaint.setFont(QFont(font, 33*fontFactor));
    fm = pixPaint.fontMetrics();
    titleTextWidth  = fm.width(titleText);
    pixPaint.drawText(newPixmap.width()-titleTextWidth-paddingRight,paddingTop,titleText);

    pixPaint.setFont(QFont(font, 15*fontFactor));

    // if the version string is to long, reduce size
    fm = pixPaint.fontMetrics();
    int versionTextWidth  = fm.width(versionText);
    if(versionTextWidth > titleTextWidth+paddingRight-10) {
        pixPaint.setFont(QFont(font, 10*fontFactor));
        titleVersionVSpace -= 5;
    }
    pixPaint.drawText(newPixmap.width()-titleTextWidth-paddingRight+2,paddingTop+titleVersionVSpace,versionText);

    // draw copyright stuff
    pixPaint.setFont(QFont(font, 10*fontFactor));
    pixPaint.drawText(newPixmap.width()-titleTextWidth-paddingRight,paddingTop+titleCopyrightVSpace,copyrightText);

    // draw testnet string if testnet is on
    if(isTestNet) {
        QFont boldFont = QFont(font, 10*fontFactor);
        boldFont.setWeight(QFont::Bold);
        pixPaint.setFont(boldFont);
        fm = pixPaint.fontMetrics();
        int testnetAddTextWidth  = fm.width(testnetAddText);
        pixPaint.drawText(newPixmap.width()-testnetAddTextWidth-10,15,testnetAddText);
    }

    pixPaint.end();

    this->setPixmap(newPixmap);

    subscribeToCoreSignals();
}
开发者ID:CoinWarden,项目名称:Mrcoin,代码行数:78,代码来源:splashscreen.cpp


示例5: QMainWindow

MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{
    isStart = false;
    isHexWorkspace = true;

    mAbout = new AboutUi(this);

    threadBuffer = (unsigned char*) malloc(BUFFER_SIZE);
    hexBuffer = (char*) malloc(4000);

    mSerialThread = new SerialThread(threadBuffer,BUFFER_SIZE);

    numberOfCharacter = 0;

    temp.reserve(1000);
    asciiOriginalBuffer.reserve(1000);

    QPixmap pix = QPixmap(":/MainUi/Start.png");
    iconStart = new QIcon(pix);
    pix = QPixmap(":/MainUi/Stop.png");
    iconStop = new QIcon(pix);
    pix = QPixmap(":/MainUi/Ascii.png");
    iconAscii = new QIcon(pix);
    pix = QPixmap(":/MainUi/Hex.png");
    iconHex = new QIcon(pix);
    pix = QPixmap(":/MainUi/DSR_R.png");
    iconDSR_R = new QIcon(pix);
    pix = QPixmap(":/MainUi/DTR_R.png");
    iconDTR_R = new QIcon(pix);
    pix = QPixmap(":/MainUi/RTS_R.png");
    iconRTS_R = new QIcon(pix);
    pix = QPixmap(":/MainUi/CTS_R.png");
    iconCTS_R = new QIcon(pix);
    pix = QPixmap(":/MainUi/DCD_R.png");
    iconDCD_R = new QIcon(pix);
    pix = QPixmap(":/MainUi/RNG_R.png");
    iconRNG_R = new QIcon(pix);
    pix = QPixmap(":/MainUi/DSR_V.png");
    iconDSR_V = new QIcon(pix);
    pix = QPixmap(":/MainUi/DTR_V.png");
    iconDTR_V = new QIcon(pix);
    pix = QPixmap(":/MainUi/RTS_V.png");
    iconRTS_V = new QIcon(pix);
    pix = QPixmap(":/MainUi/CTS_V.png");
    iconCTS_V = new QIcon(pix);
    pix = QPixmap(":/MainUi/DCD_V.png");
    iconDCD_V = new QIcon(pix);
    pix = QPixmap(":/MainUi/RNG_V.png");
    iconRNG_V = new QIcon(pix);

    mSerialPort = new QComboBox;
    Utils::setPortComList(mSerialPort);
    // Setup by setPortComList
    //mSerialPort->setCurrentIndex(0);

    mBaudrate = new QComboBox;
    QStringList baudrate;
    baudrate << tr("230400") << tr("115200") << tr("57600") << tr("56000") << tr("38400") << tr("28800") << tr("19200") << tr("14400") << tr("9600") << tr("4800") << tr("2400") << tr("1200") << tr("600") << tr("300") << tr("110");
    mBaudrate->addItems(baudrate);
    mBaudrate->setCurrentIndex(1);

    mStartStop = new QAction(tr("StartStop"), this);
    mStartStop->setShortcut(tr("Ctrl+Return"));
    mStartStop->setToolTip(tr("Start communication"));
    mStartStop->setStatusTip(tr("Start communication"));
    mStartStop->setWhatsThis(tr("Start communication"));
    mStartStop->setIcon(*iconStart);

    mHexAscii = new QAction(tr("HexAscii"), this);
    mHexAscii->setShortcut(tr("Ctrl+A"));
    mHexAscii->setToolTip(tr("Change to Ascii workspace"));
    mHexAscii->setStatusTip(tr("Change to Ascii workspace"));
    mHexAscii->setWhatsThis(tr("Change to Ascii workspace"));
    mHexAscii->setIcon(*iconAscii);

    mClearButton = new QAction(tr("Clear"), this);
    mClearButton->setShortcut(tr("Ctrl+E"));
    mClearButton->setToolTip(tr("Clean output ascii and hex"));
    mClearButton->setStatusTip(tr("Clean output ascii and hex"));
    mClearButton->setWhatsThis(tr("Clean output ascii and hex"));
    mClearButton->setIcon( QIcon(QPixmap(":/MainUi/Delete.png")));

    mConfigToolbar = addToolBar(tr("Pointer type"));
    mConfigToolbar->addWidget(mSerialPort);
    mConfigToolbar->addWidget(mBaudrate);
    mConfigToolbar->addAction(mStartStop);
    mConfigToolbar->addAction(mHexAscii);
    mConfigToolbar->addAction(mClearButton);

    ui->setupUi(this);

    connect( mStartStop, SIGNAL(triggered() ), this, SLOT(eventStartStop()) );
    connect( mHexAscii, SIGNAL(triggered() ), this, SLOT(eventHexAscii()) );
    connect( mClearButton, SIGNAL(triggered() ), this, SLOT(eventClearButton()) );
    connect( ui->actionQuit, SIGNAL(triggered() ), this, SLOT(eventQuit()) );
    connect( ui->actionAbout, SIGNAL(triggered() ), this, SLOT(eventAbout()) );
    connect( ui->actionSaveInputOutput, SIGNAL(triggered() ), this, SLOT(eventSaveInputOutput()) );
    connect( ui->actionSaveTerminalContent, SIGNAL(triggered() ), this, SLOT(eventSaveTerminalContent()) );
    connect( ui->actionSave_Input_Output, SIGNAL(triggered() ), this, SLOT(eventSaveInputOutput()) );
    connect( ui->actionSave_Terminal_Content, SIGNAL(triggered() ), this, SLOT(eventSaveTerminalContent()) );
//.........这里部分代码省略.........
开发者ID:401968875,项目名称:serialterminal,代码行数:101,代码来源:MainWindow.cpp


示例6: QGridLayout


//.........这里部分代码省略.........
    for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++)
    {
        HHHats[i] = new HatButton(GBoxHedgehogs);
        GBHLayout->addWidget(HHHats[i], i + 1, 0);

        HHNameEdit[i] = new QLineEdit(GBoxHedgehogs);
        HHNameEdit[i]->setMaxLength(64);
        HHNameEdit[i]->setMinimumWidth(120);
        HHNameEdit[i]->setFixedHeight(36);
        HHNameEdit[i]->setWhatsThis(tr("This hedgehog's name"));
        HHNameEdit[i]->setStyleSheet("padding: 6px;");
        GBHLayout->addWidget(HHNameEdit[i], i + 1, 1);

        btnRandomHogName[i] = addButton(":/res/dice.png", GBHLayout, i + 1, 3, 1, 1, true);
        btnRandomHogName[i]->setFixedHeight(HHNameEdit[i]->height());
        btnRandomHogName[i]->setWhatsThis(tr("Randomize this hedgehog's name"));
    }

    btnRandomTeam = new QPushButton();
    btnRandomTeam->setText(tr("Random Team"));
    btnRandomTeam->setStyleSheet("padding: 6px 10px;");
    GBHLayout->addWidget(btnRandomTeam, 9, 0, 1, 4, Qt::AlignCenter);
    btnRandomTeam->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

    vbox1->addWidget(GBoxHedgehogs);

    GBoxTeam = new QGroupBox(this);
    GBoxTeam->setTitle(QGroupBox::tr("Team Settings"));
    GBoxTeam->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    QGridLayout * GBTLayout = new QGridLayout(GBoxTeam);
    QLabel * tmpLabel = new QLabel(GBoxTeam);
    tmpLabel->setText(QLabel::tr("Name"));
    GBTLayout->addWidget(tmpLabel, 0, 0);
    tmpLabel = new QLabel(GBoxTeam);
    tmpLabel->setText(QLabel::tr("Type"));
    GBTLayout->addWidget(tmpLabel, 1, 0);
    tmpLabel = new QLabel(GBoxTeam);
    tmpLabel->setText(QLabel::tr("Grave"));
    GBTLayout->addWidget(tmpLabel, 2, 0);
    tmpLabel = new QLabel(GBoxTeam);
    tmpLabel->setText(QLabel::tr("Flag"));
    GBTLayout->addWidget(tmpLabel, 3, 0);
    tmpLabel = new QLabel(GBoxTeam);
    tmpLabel->setText(QLabel::tr("Voice"));
    GBTLayout->addWidget(tmpLabel, 4, 0);

    TeamNameEdit = new QLineEdit(GBoxTeam);
    TeamNameEdit->setMaxLength(64);
    GBTLayout->addWidget(TeamNameEdit, 0, 1);
    vbox2->addWidget(GBoxTeam);

    CBTeamLvl = new QComboBox(GBoxTeam);
    CBTeamLvl->setIconSize(QSize(48, 48));
    CBTeamLvl->addItem(QIcon(":/res/botlevels/0.png"), QComboBox::tr("Human"));
    for(int i = 5; i > 0; i--)
        CBTeamLvl->addItem(
            QIcon(QString(":/res/botlevels/%1.png").arg(6 - i)),
            QString("%1 %2").arg(QComboBox::tr("Level")).arg(i)
        );
    GBTLayout->addWidget(CBTeamLvl, 1, 1);

    CBGrave = new QComboBox(GBoxTeam);
    CBGrave->setMaxCount(65535);
    CBGrave->setIconSize(QSize(32, 32));
    GBTLayout->addWidget(CBGrave, 2, 1);

    CBFlag = new QComboBox(GBoxTeam);
    CBFlag->setMaxCount(65535);
    CBFlag->setIconSize(QSize(22, 15));
    GBTLayout->addWidget(CBFlag, 3, 1);

    QHBoxLayout * hbox = new QHBoxLayout();
    CBVoicepack = new QComboBox(GBoxTeam);

    hbox->addWidget(CBVoicepack, 100);
    btnTestSound = addSoundlessButton(":/res/PlaySound.png", hbox, 1, true);
    hbox->setStretchFactor(btnTestSound, 1);

    GBTLayout->addLayout(hbox, 4, 1);

    GBoxFort = new QGroupBox(this);
    GBoxFort->setTitle(QGroupBox::tr("Fort"));
    QGridLayout * GBFLayout = new QGridLayout(GBoxFort);
    CBFort = new QComboBox(GBoxFort);
    CBFort->setMaxCount(65535);
    GBFLayout->addWidget(CBFort, 0, 0);
    FortPreview = new SquareLabel(GBoxFort);
    FortPreview->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    FortPreview->setMinimumSize(128, 128);
    FortPreview->setPixmap(QPixmap());
    // perhaps due to handling its own paintevents, SquareLabel doesn't play nice with the stars
    //FortPreview->setAttribute(Qt::WA_PaintOnScreen, true);
    GBFLayout->addWidget(FortPreview, 1, 0);
    vbox2->addWidget(GBoxFort);

    vbox1->addStretch();
    vbox2->addStretch();

    return pageLayout;
}
开发者ID:EchoLiao,项目名称:hedgewars,代码行数:101,代码来源:pageeditteam.cpp


示例7: setupUi

DwarfClipboard::DwarfClipboard()
{

    setupUi(this);
    createActions();
    createTrayIcon();
    trayIcon->setIcon(QIcon(":/icons/images/DwarfClipboard.png"));
    trayIcon->show();
    setWindowTitle(tr("DwarfClipboard"));
    inputDelay = 100;
    thumbnailSize = 64;
    prevCursor.x = -30000;
    createShortcuts();
    heartbeatTimer = new QTimer(this);
    connectedLabel = new QLabel();
    createConnections();
    recentModel = new DwarfClipboardModel();
    tableViewRecent->setModel(recentModel);
    libraryModel = new DwarfClipboardModel();
    treeViewLibrary->setModel(libraryModel);

    DFMgr = NULL;
    DF = NULL;
    Pos = NULL;

    connected = connectToDF();
    loadConfig();
    thumbnailSizeLineEdit->setText(QString("%1").arg(thumbnailSize));
    inputDelayMsLineEdit->setText(QString("%1").arg(inputDelay));

    tilesetPathButton->setText(DwarfClipboardPng::getTileSetPath());
    colorPathButton->setText(DwarfClipboardPng::getColorPath());

    copyShortcutButton->setText(copyShortcut->shortcut());
    pasteDesignationShortcutButton->setText(pasteDesignationShortcut->shortcut());
    pasteBuildingShortcutButton->setText(pasteBuildingShortcut->shortcut());
    setCursorToPreviousPasteShortcutButton->setText(setCursorToPreviousPasteShortcut->shortcut());
    
    heartbeatTimer->start(1000);

    Ui_MainWindow::statusBar->addPermanentWidget(connectedLabel);
    
    connectedIcon = QPixmap(":/icons/images/connect.png");
    
    //This mess just converts the disconnected icon to look the same as a disabled one
    //It is the same code used in the icon object
    disconnectedIcon = QPixmap(":/icons/images/disconnect.png");
    QStyleOption opt(0);
    opt.palette = QApplication::palette();
    QPixmap generated = QApplication::style()->generatedIconPixmap(QIcon::Disabled, disconnectedIcon, &opt);
    disconnectedIcon = generated;
    loadDirectory();
    loadBuildCommands();
    if(connected){
        connected = false; //this is ugly, but just ensures everything will be set proprly
        setConnected();
    }
    else{
        connected = true;
        setDisconnected();
    }
    setupViews();   
}
开发者ID:jimhester,项目名称:Dwarf-Clipboard,代码行数:63,代码来源:DwarfClipboard.cpp


示例8: theme

void ThemeCreationWizard::onFinished(int status)
{
    if (status == 0)
        return;
    try
    {
        StfsPackage theme(ui->lblSavePath->text().toStdString(), StfsPackageCreate);

        // create a new file
        theme.metaData->magic = CON;
        theme.metaData->certificate.ownerConsoleType = consoleType;
        theme.metaData->certificate.consoleTypeFlags = (ConsoleTypeFlags)0;

        theme.metaData->contentType = Theme;
        theme.metaData->metaDataVersion = 2;
        theme.metaData->titleID = 0xFFFE07D1;

        theme.metaData->displayName = ui->txtName->text().toStdWString();
        theme.metaData->titleName = L"Xbox360 Dashboard";
        theme.metaData->transferFlags = 0x40;

        // set gamerpicture
        QByteArray ba1;
        QBuffer buffer1(&ba1);
        buffer1.open(QIODevice::WriteOnly);
        ui->imgThumbnail->pixmap()->save(&buffer1, "PNG");
        theme.metaData->thumbnailImage = (BYTE*)ba1.data();
        theme.metaData->thumbnailImageSize = ba1.length();

        // set title thumbnail image
        QByteArray ba2;
        QBuffer buffer2(&ba2);
        buffer2.open(QIODevice::WriteOnly);
        QPixmap(":/Images/defaultTitleImage.png").save(&buffer2, "PNG");
        theme.metaData->titleThumbnailImage = (BYTE*)ba2.data();
        theme.metaData->titleThumbnailImageSize = ba2.length();

        theme.metaData->WriteMetaData();
        theme.Rehash();

        // inject the wallpapers
        injectImage(&theme, &wallpaper1, "Wallpaper1");
        injectImage(&theme, &wallpaper2, "Wallpaper2");
        injectImage(&theme, &wallpaper3, "Wallpaper3");
        injectImage(&theme, &wallpaper4, "Wallpaper4");

        // create the parameters.ini file
        QString paramsFilePath = QDir::tempPath() + "/" + QUuid::createUuid().toString().replace("{", "").replace("}", "").replace("-", "");
        QFile params(paramsFilePath);
        params.open(QIODevice::Truncate | QIODevice::WriteOnly);

        // write the correct information to it
        QTextStream txtStream(&params);
        txtStream << "SphereColor=" << ui->cmbxSphereColor->currentIndex() << "\r\nAvatarLightingDirectional=0,0,0,0\r\nAvatarLightingAmbient=0\r\n";

        // close the file
        txtStream.flush();
        params.close();

        // inject the params file to the theme package
        theme.InjectFile(paramsFilePath.toStdString(), "parameters.ini");

        // create the dash style file
        QString dashStyleFilePath = QDir::tempPath() + "/" + QUuid::createUuid().toString().replace("{", "").replace("}", "").replace("-", "");
        FileIO ioD(dashStyleFilePath.toStdString(), true);
        ioD.write((DWORD)0);
        ioD.close();

        // inject the file
        theme.InjectFile(dashStyleFilePath.toStdString(), "DashStyle");

        // fix the package
        theme.Rehash();
        theme.Resign(QtHelpers::GetKVPath(theme.metaData->certificate.ownerConsoleType, this));

        // delete the temp files
        QFile::remove(paramsFilePath);
        QFile::remove(dashStyleFilePath);

        statusBar->showMessage("Theme created successfully", 3000);
    }
    catch (string error)
    {
        QMessageBox::critical(this, "Error", "An error occured while creating the theme.\n\n" + QString::fromStdString(error));
    }
}
开发者ID:AndoniZubimendi,项目名称:Velocity,代码行数:86,代码来源:themecreationwizard.cpp


示例9: QWidget

SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle *networkStyle) :
    QWidget(0, f), curAlignment(0)
{
    // set reference point, paddings
    int paddingRight            = 50;
    int paddingTop              = 50;
    int titleVersionVSpace      = 17;
    int titleCopyrightVSpace    = 40;

    float fontFactor            = 1.0;
    float devicePixelRatio      = 1.0;
#if QT_VERSION > 0x050100
    devicePixelRatio = ((QGuiApplication*)QCoreApplication::instance())->devicePixelRatio();
#endif

    // define text to place
    QString titleText       = tr("Bitcoin8m Core");
    QString versionText     = QString("Version %1").arg(QString::fromStdString(FormatFullVersion()));
    QString copyrightText   = QChar(0xA9)+QString(" 2009-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The Bitcoin8m Core developers"));
    QString titleAddText    = networkStyle->getTitleAddText();

    QString font            = QApplication::font().toString();

    // create a bitmap according to device pixelratio
    QSize splashSize(480*devicePixelRatio,320*devicePixelRatio);
    pixmap = QPixmap(splashSize);

#if QT_VERSION > 0x050100
    // change to HiDPI if it makes sense
    pixmap.setDevicePixelRatio(devicePixelRatio);
#endif

    QPainter pixPaint(&pixmap);
    pixPaint.setPen(QColor(100,100,100));

    // draw a slightly radial gradient
    QRadialGradient gradient(QPoint(0,0), splashSize.width()/devicePixelRatio);
    gradient.setColorAt(0, Qt::white);
    gradient.setColorAt(1, QColor(247,247,247));
    QRect rGradient(QPoint(0,0), splashSize);
    pixPaint.fillRect(rGradient, gradient);

    // draw the bitcoin8m icon, expected size of PNG: 1024x1024
    QRect rectIcon(QPoint(-150,-122), QSize(430,430));

    const QSize requiredSize(1024,1024);
    QPixmap icon(networkStyle->getAppIcon().pixmap(requiredSize));

    pixPaint.drawPixmap(rectIcon, icon);

    // check font size and drawing with
    pixPaint.setFont(QFont(font, 33*fontFactor));
    QFontMetrics fm = pixPaint.fontMetrics();
    int titleTextWidth  = fm.width(titleText);
    if(titleTextWidth > 160) {
        // strange font rendering, Arial probably not found
        fontFactor = 0.75;
    }

    pixPaint.setFont(QFont(font, 33*fontFactor));
    fm = pixPaint.fontMetrics();
    titleTextWidth  = fm.width(titleText);
    pixPaint.drawText(pixmap.width()/devicePixelRatio-titleTextWidth-paddingRight,paddingTop,titleText);

    pixPaint.setFont(QFont(font, 15*fontFactor));

    // if the version string is to long, reduce size
    fm = pixPaint.fontMetrics();
    int versionTextWidth  = fm.width(versionText);
    if(versionTextWidth > titleTextWidth+paddingRight-10) {
        pixPaint.setFont(QFont(font, 10*fontFactor));
        titleVersionVSpace -= 5;
    }
    pixPaint.drawText(pixmap.width()/devicePixelRatio-titleTextWidth-paddingRight+2,paddingTop+titleVersionVSpace,versionText);

    // draw copyright stuff
    pixPaint.setFont(QFont(font, 10*fontFactor));
    pixPaint.drawText(pixmap.width()/devicePixelRatio-titleTextWidth-paddingRight,paddingTop+titleCopyrightVSpace,copyrightText);

    // draw additional text if special network
    if(!titleAddText.isEmpty()) {
        QFont boldFont = QFont(font, 10*fontFactor);
        boldFont.setWeight(QFont::Bold);
        pixPaint.setFont(boldFont);
        fm = pixPaint.fontMetrics();
        int titleAddTextWidth  = fm.width(titleAddText);
        pixPaint.drawText(pixmap.width()/devicePixelRatio-titleAddTextWidth-10,15,titleAddText);
    }

    pixPaint.end();

    // Set window title
    setWindowTitle(titleText + " " + titleAddText);

    // Resize window and move to center of desktop, disallow resizing
    QRect r(QPoint(), QSize(pixmap.size().width()/devicePixelRatio,pixmap.size().height()/devicePixelRatio));
    resize(r.size());
    setFixedSize(r.size());
    move(QApplication::desktop()->screenGeometry().center() - r.center());

//.........这里部分代码省略.........
开发者ID:bitcoin8m,项目名称:B8M,代码行数:101,代码来源:splashscreen.cpp


示例10: QMainWindow

CaptureWgt::CaptureWgt( QWidget * parent )
: QMainWindow( parent )
{
    pd = new PD();
    pd->ui.setupUi( this );
    pd->crossFname = "./video.ini";
    pd->modifyLaserPos = false;
    pd->devMenu = 0;
    pd->resMenu = 0;
    pd->imgScale = 1.0;
    pd->drawArrow = false;
    pd->flipX = false;
    pd->flipY = false;
    pd->resolutionAcquired = false;
    pd->cap = new Capture( this );
    pd->ui.brightnessDw->setVisible( false );
    pd->brightness = new BrightnessWgt( this );
    pd->ui.brightnessDw->setWidget( pd->brightness );
    pd->cap->setBrightnessRange( pd->brightness->range() );
    connect( pd->brightness, SIGNAL(rangeChanged(const QPointF &)), 
             this,           SLOT(slotBrightnessChanged(const QPointF &)) );
    connect( pd->ui.brightnessRange, SIGNAL(triggered()), 
             this,                   SLOT(slotBrightness()) );

    Ui_CaptureWgt & ui = pd->ui;
    connect( ui.capture,  SIGNAL(triggered()), this, SLOT(slotCapture()) );
    connect( ui.settings, SIGNAL(triggered()), this, SLOT(slotSettings()) );
    connect( ui.cross,    SIGNAL(triggered()), this, SLOT(slotCrossEmphasis()) );

    pd->scene = new QGraphicsScene( pd->ui.view );
    pd->scene->setBackgroundBrush( QBrush( Qt::gray ) );
    pd->ui.view->setScene( pd->scene );

    pd->image = new QGraphicsPixmapItem( 0, pd->scene );
    pd->image->setPos( 0.0, 0.0 );
    pd->lineX1 = new QGraphicsLineItem( pd->image, pd->scene );
    pd->lineY1 = new QGraphicsLineItem( pd->image, pd->scene );
    pd->lineX2 = new QGraphicsLineItem( pd->image, pd->scene );
    pd->lineY2 = new QGraphicsLineItem( pd->image, pd->scene );
    pd->arrow = new QGraphicsPolygonItem( pd->image, pd->scene );
    // This is for laser spot position.
    pd->laserPosImage = new QGraphicsPixmapItem( 0, pd->scene );
    pd->laserPosImage->setPixmap( QPixmap( ":/images/laser.png" ) );
    pd->laserPosImage->setPos( -pd->laserPosImage->pixmap().width()/2, -pd->laserPosImage->pixmap().height()/2 );
    pd->laserPosImage->setVisible( false );

    connect( pd->ui.flipX, SIGNAL(triggered()), this, SLOT(slotFlipX()) );
    connect( pd->ui.flipY, SIGNAL(triggered()), this, SLOT(slotFlipY()) );

    pd->cap = new Capture( this );
    listDevices();
    connect( pd->cap, SIGNAL(frame(const QImage &)), this, SLOT(slotFrame(const QImage &)) );

    ui.view->installEventFilter( this );

    pd->inMenu = new QMenu( this );
    ui.input->setMenu( pd->inMenu );
    QAction * a = new QAction( "Default", this );
    a->setCheckable( true );
    a->setChecked( true );
    pd->inMenu->addAction( a );
    pd->inList << a;

    a = new QAction( "Usb", this );
    a->setCheckable( true );
    pd->inMenu->addAction( a );
    pd->inList << a;

    a = new QAction( "S-Video", this );
    a->setCheckable( true );
    pd->inMenu->addAction( a );
    pd->inList << a;

    a = new QAction( "Composite", this );
    a->setCheckable( true );
    pd->inMenu->addAction( a );
    pd->inList << a;

    for ( int i=0; i<pd->inList.size(); i++ )
    {
        QAction * a = pd->inList[i];
        connect( a, SIGNAL(triggered()), this, SLOT(slotInput()) );
    }

    // ƒействи¤ соответствующие фильтрам.
    pd->filterList << ui.equalizeHist;
    pd->filterList << ui.fullContrast;
    pd->filterList << ui.sobel;
    pd->filterList << ui.median;
    pd->filterList << ui.timeSmooth;
    pd->filterList << ui.highPass;
    pd->filterList << ui.surface;
    pd->filterList << ui.brightnessRange;
    for ( int i=0; i<pd->filterList.size(); i++ )
    {
        QAction * a = pd->filterList[i];
        connect( a, SIGNAL(triggered()), this, SLOT(slotFilter()) );
    }

    connect( ui.pixmap, SIGNAL(triggered()), this, SLOT(slotPixmap()) );
//.........这里部分代码省略.........
开发者ID:z80,项目名称:chassis,代码行数:101,代码来源:capture_wgt.cpp


示例11: QPixmap

void RtKeyboard::LoadButtonImages(void)
{
//  Load background image
    m_ImageBackground = QPixmap(g_strKeyboardBK);

// Load Key1 image
    m_Key1[0] = QPixmap(g_strKey1Up);
    m_Key1[1] = QPixmap(g_strKey1Down);

// Load Key2 image
    m_Key2[0] = QPixmap(g_strKey2Up);
    m_Key2[1] = QPixmap(g_strKey2Down);

// Load Key3 image
    m_Key3[0] = QPixmap(g_strKey3Up);
    m_Key3[1] = QPixmap(g_strKey3Down);

// Load Key4 image
    m_Key4[0] = QPixmap(g_strKey4Up);
    m_Key4[1] = QPixmap(g_strKey4Down);

// Load Key5 image
    m_Key5[0] = QPixmap(g_strKey5Up);
    m_Key5[1] = QPixmap(g_strKey5Down);

// Load Key6 image
    m_Key6[0] = QPixmap(g_strKey6Up);
    m_Key6[1] = QPixmap(g_strKey6Down);

// Load Key7 image
    m_Key7[0] = QPixmap(g_strKey7Up);
    m_Key7[1] = QPixmap(g_strKey7Down);

// Load Key Del image
    m_Key_Del[0] = QPixmap(g_strKeyDelUp);
    m_Key_Del[1] = QPixmap(g_strKeyDelDown);

// Load Key Enter image
    m_Key_Enter[0] = QPixmap(g_strKeyEnterUp);
    m_Key_Enter[1] = QPixmap(g_strKeyEnterDown);

// Load Key Switch image
   m_Key_Switch[0] = QPixmap(g_strKeySwitchUp);
   m_Key_Switch[1] = QPixmap(g_strKeySwitchDown);
}
开发者ID:bravesheng,项目名称:offroad-navi,代码行数:45,代码来源:RtKeyboard.cpp


示例12: finishExport

void ModelExportForm::handleExportFinished(void)
{
	finishExport(trUtf8("Exporting process sucessfuly ended!"));
	ico_lbl->setPixmap(QPixmap(QString(":/icones/icones/msgbox_info.png")));
}
开发者ID:Fisiu,项目名称:pgmodeler,代码行数:5,代码来源:modelexportform.cpp


示例13: LineEdit

QWizardPage *AddFeedWizard::createUrlFeedPage()
{
  QWizardPage *page = new QWizardPage;
  page->setTitle(tr("Create New Feed"));

  selectedPage = false;
  finishOn = false;

  urlFeedEdit_ = new LineEdit(this);
  urlFeedEdit_->setText("http://");

  titleFeedAsName_ = new QCheckBox(
        tr("Use title of the feed as displayed name"), this);
  titleFeedAsName_->setChecked(true);

  authentication_ = new QGroupBox(this);
  authentication_->setTitle(tr("Server requires authentication:"));
  authentication_->setCheckable(true);
  authentication_->setChecked(false);

  user_ = new LineEdit(this);
  pass_ = new LineEdit(this);
  pass_->setEchoMode(QLineEdit::Password);

  QGridLayout *authenticationLayout = new QGridLayout();
  authenticationLayout->addWidget(new QLabel(tr("Username:")), 0, 0);
  authenticationLayout->addWidget(user_, 0, 1);
  authenticationLayout->addWidget(new QLabel(tr("Password:")), 1, 0);
  authenticationLayout->addWidget(pass_, 1, 1);

  authentication_->setLayout(authenticationLayout);

  QLabel *iconWarning = new QLabel(this);
  iconWarning->setPixmap(QPixmap(":/images/warning"));
  textWarning = new QLabel(this);
  QFont font = textWarning->font();
  font.setBold(true);
  textWarning->setFont(font);

  QHBoxLayout *warningLayout = new QHBoxLayout();
  warningLayout->setMargin(0);
  warningLayout->addWidget(iconWarning);
  warningLayout->addWidget(textWarning, 1);

  warningWidget_ = new QWidget(this);
  warningWidget_->setLayout(warningLayout);

  progressBar_ = new QProgressBar(this);
  progressBar_->setObjectName("progressBar_");
  progressBar_->setTextVisible(false);
  progressBar_->setFixedHeight(15);
  progressBar_->setMinimum(0);
  progressBar_->setMaximum(0);
  progressBar_->setVisible(false);

  QVBoxLayout *layout = new QVBoxLayout;
  layout->addWidget(new QLabel(tr("Feed URL or website address:")));
  layout->addWidget(urlFeedEdit_);
  layout->addWidget(titleFeedAsName_);
  layout->addSpacing(10);
  layout->addWidget(authentication_);
  layout->addStretch(1);
  layout->addWidget(warningWidget_);
  layout->addWidget(progressBar_);
  page->setLayout(layout);

  connect(urlFeedEdit_, SIGNAL(textChanged(const QString&)),
          this, SLOT(urlFeedEditChanged(const QString&)));
  connect(titleFeedAsName_, SIGNAL(stateChanged(int)),
          this, SLOT(titleFeedAsNameStateChanged(int)));

  return page;
}
开发者ID:wyrover,项目名称:quiterss,代码行数:73,代码来源:addfeedwizard.cpp


示例14: qMin

void LightMaps::paintEvent(QPaintEvent *event)
{
    QPainter p;
    p.begin(this);
    m_normalMap->render(&p, event->rect());
    p.setPen(Qt::black);
    p.drawText(rect(),  Qt::AlignBottom | Qt::TextWordWrap,
               "Map data CCBYSA 2009 OpenStreetMap.org contributors");
    p.end();

    if (zoomed) {
        int dim = qMin(width(), height());
        int magnifierSize = qMin(MAX_MAGNIFIER, dim * 2 / 3);
        int radius = magnifierSize / 2;
        int ring = radius - 15;
        QSize box = QSize(magnifierSize, magnifierSize);

        // reupdate our mask
        if (maskPixmap.size() != box) {
            maskPixmap = QPixmap(box);
            maskPixmap.fill(Qt::transparent);

            QRadialGradient g;
            g.setCenter(radius, radius);
            g.setFocalPoint(radius, radius);
            g.setRadius(radius);
            g.setColorAt(1.0, QColor(255, 255, 255, 0));
            g.setColorAt(0.5, QColor(128, 128, 128, 255));

            QPainter mask(&maskPixmap);
            mask.setRenderHint(QPainter::Antialiasing);
            mask.setCompositionMode(QPainter::CompositionMode_Source);
            mask.setBrush(g);
            mask.setPen(Qt::NoPen);
            mask.drawRect(maskPixmap.rect());
            mask.setBrush(QColor(Qt::transparent));
            mask.drawEllipse(g.center(), ring, ring);
            mask.end();
        }

        QPoint center = dragPos - QPoint(0, radius);
        center = center + QPoint(0, radius / 2);
        QPoint corner = center - QPoint(radius, radius);

        QPoint xy = center * 2 - QPoint(radius, radius);

        // only set the dimension to the magnified portion
        if (zoomPixmap.size() != box) {
            zoomPixmap = QPixmap(box);
            zoomPixmap.fill(Qt::lightGray);
        }
        if (true) {
            QPainter p(&zoomPixmap);
            p.translate(-xy);
            m_largeMap->render(&p, QRect(xy, box));
            p.end();
        }

        QPainterPath clipPath;
        clipPath.addEllipse(center, ring, ring);

        QPainter p(this);
        p.setRenderHint(QPainter::Antialiasing);
        p.setClipPath(clipPath);
        p.drawPixmap(corner, zoomPixmap);
        p.setClipping(false);
        p.drawPixmap(corner, maskPixmap);
        p.setPen(Qt::gray);
        p.drawPath(clipPath);
    }
    if (invert) {
        QPainter p(this);
        p.setCompositionMode(QPainter::CompositionMode_Difference);
        p.fillRect(event->rect(), Qt::white);
        p.end();
    }
}
开发者ID:KDE,项目名称:android-qt5-qtbase,代码行数:77,代码来源:lightmaps.cpp


示例15: QVariant

QVariant TemplateListModel::data( const QModelIndex & index, int role ) const
{
  if(!index.isValid())
  {
    return QVariant();
  }
  else if( role == Qt::DecorationRole )
  {
    switch( index.row() )
    {
      case NEWFROMTEMPLATE_EMPTY:
      {
        return QPixmap(":/images/osm-icon-open.png").scaled(85,85,Qt::KeepAspectRatio,Qt::SmoothTransformation);
      }
      case NEWFROMTEMPLATE_WIZARD:
      {
        return QPixmap(":/images/wizard.png").scaled(85,85,Qt::KeepAspectRatio,Qt::SmoothTransformation);
      }
      default:
      {
        return QVariant();
      }
    }
  }
  else if( role == Qt::SizeHintRole )
  {
    return QSize(100,100);
  }
  else if( role == Qt::ToolTipRole ) 
  {
    switch( index.row() )
    {
      case NEWFROMTEMPLATE_EMPTY:
      {
        return QString("Empty Building Model");
      }
      case NEWFROMTEMPLATE_WIZARD:
      {
        return QString("Building Model From Wizard");
      }
      default:
      {
        return QVariant();
      }
    }
  }
  else if( role == Qt::WhatsThisRole ) 
  {
    switch( index.row() )
    {
      case NEWFROMTEMPLATE_EMPTY:
      {
        return QString("Create a new empty building model.  Start here if you want to add your own Zones and HVAC Systems.");
      }
      case NEWFROMTEMPLATE_WIZARD:
      {
        return QString("Create a new building model using a wizard.  \
This  

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ QPoint函数代码示例发布时间:2022-05-30
下一篇:
C++ QPersistentModelIndex函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap