本文整理汇总了C++中QPixmap::load方法的典型用法代码示例。如果您正苦于以下问题:C++ QPixmap::load方法的具体用法?C++ QPixmap::load怎么用?C++ QPixmap::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPixmap
的用法示例。
在下文中一共展示了QPixmap::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw_nextItem
void GameArea::draw_nextItem() //显示下一个要出现的图形
{
QPainter painter(this);
painter.drawRect(gameArea_width+20,10,4*step,4*step);
painter.setBrush(this->boxBrushColor);
for(int i=0;i<4;i++)
for(int j=0;j<4;j++)
{
if(*(theNextItem + i*4 +j)==1)
{
if(this->is_draw_box_picture)
{
QPixmap pix;
pix.load(this->boxPicture);
painter.drawPixmap(gameArea_width+20+j*step,10+i*step,step,step,pix);
}
painter.drawRect(gameArea_width+20+j*step,10+i*step,step,step);
}
}
}
示例2: openImage
void MainWindow::openImage(const QString &path)
{
QString fileName = path;
if (fileName.isNull())
fileName = QFileDialog::getOpenFileName(this,
tr("Open Image"), "", tr("Image Files (*.png *.jpg *.bmp)"));
if (!fileName.isEmpty()) {
QPixmap newImage;
if (!newImage.load(fileName)) {
QMessageBox::warning(this, tr("Open Image"),
tr("The image file could not be loaded."),
QMessageBox::Cancel);
return;
}
puzzleImage = newImage;
setupPuzzle();
}
}
示例3: initializeImages
void GPS::initializeImages(){
QPixmap gpsPix;
gpsPix.load(":gps");
// Create new picture for transparent
QPixmap transparent(gpsPix.size());
// Do transparency
transparent.fill(Qt::transparent);
QPainter p(&transparent);
p.setCompositionMode(QPainter::CompositionMode_Source);
p.drawPixmap(0, 0, gpsPix);
p.setCompositionMode(QPainter::CompositionMode_DestinationIn);
// Set transparency level to 150 (possible values are 0-255)
p.fillRect(transparent.rect(), QColor(0, 0, 0, 150));
p.end();
// Set original picture's reference to new transparent one
gpsPix = transparent;
gps = new QGraphicsPixmapItem(gpsPix);
halfSizeImage = gpsPix.size().height() / 2;
gps->setTransformationMode(Qt::SmoothTransformation);
gps->setScale(sizes[index]);
gps->setOffset(-halfSizeImage, -halfSizeImage);
QFont b;
gpsScene->addItem(gps);
b.setStyleHint(QFont::Decorative);
b.setBold(true);
b.setPointSize(16);
latitude=gpsScene->addSimpleText("Latitude: 0",b);
longitude=gpsScene->addSimpleText("Longitude: 0",b);
latitude->setPos(latitudePosition.x() * sizes[index] - halfSizeImage * sizes[index], latitudePosition.y() * sizes[index] - halfSizeImage * sizes[index]);
longitude->setPos(longitudePosition.x() * sizes[index] - halfSizeImage * sizes[index], longitudePosition.y() * sizes[index] - halfSizeImage * sizes[index]);
}
示例4: main
int main(int argc, char *argv[])
{
KAboutData aboutData( "WebPhonon", "WebPhonon",
ki18n("WebPhonon"), "1.4",
ki18n("Media Player"),
KAboutData::License_GPL,
ki18n("Copyright (c) 2013 Zakhrov") );
KCmdLineArgs::init( argc, argv, &aboutData );
KCmdLineOptions options; //new
options.add("+[file]", ki18n("Document to open")); //new
KCmdLineArgs::addCmdLineOptions(options); //new
QApplication a(argc, argv);
QCoreApplication::setApplicationName("WebPhonon");
MainWindow w;
QPixmap img;
img.load(":/splash/WebPhonon-Master-text2.png");
QSplashScreen spl;
spl.setPixmap(img);
spl.show();
QStringList cmd=a.arguments();
// QTextStream cout(stdout);
// cout<<argv[0]<<endl;
// cout<<argv[1]<<endl;
// if(!cmd.isEmpty())
// {
// w.cmdopen(cmd.last());
// }
KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); //new
if(args->count()) //new
{
w.cmdopen(args->url(0).url()); //new
}
w.showMaximized();
return a.exec();
}
示例5: display
void KWindowInfo::display( const QString &text, const QPixmap &pix )
{
QPixmap icon;
if ( pix.isNull() )
icon.load( "bell.png" );
else
icon = pix;
if ( win->inherits( "KSystemTray" ) ) {
KSystemTray *tray = static_cast<KSystemTray *>( win );
tray->setPixmap( icon );
QToolTip::add( tray, text );
return;
}
win->setCaption( text );
win->setIcon( icon );
#ifdef Q_WS_X11
KWin::setIcons( win->winId(), icon, icon );
#endif
}
示例6:
QPixmap * MrmlView::getPixmap( const KURL& url )
{
QString u = url.url();
QPixmap *pix = m_pixmapCache.find( u );
if ( pix )
return pix;
if ( url.isLocalFile() ) {
QPixmap p;
if ( !p.load( url.path() ) )
p = m_unavailablePixmap;
m_pixmapCache.insert( u, p );
return m_pixmapCache.find( u );
}
else { // remote url, download with KIO
Loader::self()->requestDownload( url );
}
return 0L;
}
示例7: mousePressEvent
void PixmapViewer::mousePressEvent(QMouseEvent* e)
{
if (e->buttons()) {
if (e->buttons() & Qt::RightButton) {
if ( QMessageBox::warning(0, "Unset image?", QString("Unset image?")) ) {
setPixmap(QPixmap());
emit changed();
}
} else {
QString file = QFileDialog::getOpenFileName(0, "Select an image");
QPixmap tmp;
if (!file.isEmpty()) {
if (tmp.load ( file ) ) {
setPixmap(tmp);
QMessageBox::warning(0, "Failure loading image", QString("Failed load image file %1").arg(file));
emit changed();
}
}
}
}
}
示例8: addEmoticonIndex
void KEmoticonsProvider::addEmoticonIndex(const QString &path, const QStringList &emoList)
{
foreach(const QString &s, emoList) {
KEmoticonsProvider::Emoticon e;
QPixmap p;
QString escaped = Qt::escape(s);
e.picPath = path;
p.load(path);
e.picHTMLCode = QString("<img align=\"center\" title=\"%1\" alt=\"%1\" src=\"%2\" width=\"%3\" height=\"%4\" />").arg(escaped).arg(path).arg(p.width()).arg(p.height());
e.matchTextEscaped = escaped;
e.matchText = s;
if (!s.isEmpty() && !escaped.isEmpty())
{
d->m_emoticonsIndex[escaped[0]].append(e);
d->m_emoticonsIndex[s[0]].append(e);
}
}
示例9: set_editsearch
void qmainstackwidget::set_editsearch()
{
edit_search = new QLineEdit(this);
edit_search->setGeometry(0, 110, 283, 25);
edit_search->setFont(QFont("Timers", 10, QFont::StyleOblique));
edit_search->setStyleSheet("QLineEdit{border: 2px solid rgb(22, 154, 218);padding: 0 8px;background: rgb(21, 127, 178);selection-background-color: darkgray;color:rgb(240, 255, 255);}");
QPushButton *search = new QPushButton(this);
search->setFlat(true);
QPixmap pix;
pix.load("search.jpg");
pix = pix.scaled(18, 18);
QIcon icon_search(pix);
search->setIcon(icon_search);
search->setFixedSize(18, 18);
search->move(edit_search->width() - search->width() - 2, (edit_search->height() - search->height()) / 2);
search->setGeometry(263, 115, search->width(), search->height());
search->setStyleSheet("QPushButton{ border-image:url(search.png); }"
"QPushButton:press{border-image:url(search_press.png);}"
"QPushButton:hover{border-image:url(search_hover.png);}");
search->setCursor(QCursor(Qt::PointingHandCursor));
}
示例10: makeIcon
void QGroupList::makeIcon(QCPItem* anItem)
{
QPixmap orig(ICON_DIM, ICON_DIM);
QPixmap pix;
orig.fill(Qt::transparent);
QPainter painter(&orig);
painter.drawPixmap(0, 0, ICON_DIM, ICON_DIM, anItem->icon().pixmap(ICON_DIM));
if ( anItem->isRootRequired() && pix.load(ROOT_PICTURE) )
{
painter.drawPixmap(orig.width() - pix.width(), 0 , pix);
anItem->setIcon(QIcon(orig));
}
anItem->setIcon(QIcon(orig));
}
示例11: loadTile
void TileList::loadTile(const QString &path)
{
QString fileName = path;
if (fileName.isNull())
fileName = QFileDialog::getOpenFileName(this,
tr("Open Image"), "", "Image Files (*.png *.jpg *.bmp)");
if (!fileName.isEmpty())
{
QPixmap newImage;
if (!newImage.load(fileName))
{
QMessageBox::warning(this, tr("Open Image"),
tr("The image file could not be loaded."),
QMessageBox::Cancel);
return;
}
this->tileImage = newImage;
}
}
示例12: reloadSprites
void GraphicsEngine::reloadSprites()
{
runeSprites_.clear();
QString runeFilePath = Paths::RUNES;
// Load all rune images
for (Rune* r : globalRunes_)
{
QString name = r->descriptor_.naturalName_;
QPixmap runeImage;
if (runeImage.load(runeFilePath + name.toLower() + Paths::IMAGEEXTENSION))
{
runeSprites_.push_back(runeImage);
}
else
{
cout << "ERROR : couldn't load " << (runeFilePath + name.toLower() + Paths::IMAGEEXTENSION).toStdString() << endl;
runeSprites_.push_back(runeImage);
}
}
}
示例13: run
void VideoPlayerTool::run()
{
for(;;) {
mutex.lock();
waitCondition.wait(&mutex, play_period_ms);
mutex.unlock();
playTimer->stop();
//
while(playContinuous) {
slotStepMovie();
}
QPixmap icon;
if(icon.load(":/images/pixmaps/VcrPlay.png"))
{
playMovie->setPixmap(icon);
}
}
}
示例14: draw_next_block
void GameArea::draw_next_block()
{
QPainter painter(this);
painter.drawRect(_area_width+20, 10, 4*_step, 4*_step);
painter.setBrush(_block_brush_color);
for (int i = 0; i < 4; ++i) {
for (int j = 0; j < 4; ++j) {
if (*(_next_block + i*4 + j) == 1) {
if (_is_draw_block_pic) {
QPixmap pix;
pix.load(_block_pic);
painter.drawPixmap(_area_width + 20 + j*_step,
10 + i*_step, _step, _step, pix);
}
painter.drawRect(_area_width + 20 + j*_step,
10 + i*_step, _step, _step);
}
}
}
}
示例15: loadPixmap
QPixmap loadPixmap(const QString &path)
{
qreal ratio = 1.0;
QPixmap pixmap;
const qreal devicePixelRatio = qApp->devicePixelRatio();
if (!qFuzzyCompare(ratio, devicePixelRatio)) {
QImageReader reader;
reader.setFileName(qt_findAtNxFile(path, devicePixelRatio, &ratio));
if (reader.canRead()) {
reader.setScaledSize(reader.size() * (devicePixelRatio / ratio));
pixmap = QPixmap::fromImage(reader.read());
pixmap.setDevicePixelRatio(devicePixelRatio);
}
} else {
pixmap.load(path);
}
return pixmap;
}