Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8843313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:11:22+00:00 2026-06-14T11:11:22+00:00

Could I move QPixmap into the QLabel? I haven’t found any member function which

  • 0

Could I move QPixmap into the QLabel?
I haven’t found any member function which support
move semantics or some function could move the QPixmap into the QLabel
even in Qt5.The original solution of QLabel is copy the
QPixmap you pass into the function.

According to the declaration

setPixmap(QPixmap const &)

Const& wouldn’t increase reference count(any mistake?)
I don’t think they will share the same resource

and the implementation looks more like copy than move(Qt4.8.3)

void QLabel::setPixmap(const QPixmap &pixmap)
{
    Q_D(QLabel);
    if (!d->pixmap || d->pixmap->cacheKey() != pixmap.cacheKey()) {
        d->clearContents();
        d->pixmap = new QPixmap(pixmap);
    }

    if (d->pixmap->depth() == 1 && !d->pixmap->mask())
        d->pixmap->setMask(*((QBitmap *)d->pixmap));

    d->updateLabel();
}

looks like the QLabel will create a brand new copy of the QPixmap
if the d->pixmap do not point to anything or they don’t have the
same cacheKey.

But the behavior I want is something like

QPixmap *temp = origin_pixmap;
origin_pixmap = new_pixmap;
temp->release()

or

std::string A, B;
//.............
A = std::move(B);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T11:11:23+00:00Added an answer on June 14, 2026 at 11:11 am

    Pixmap implements Copy On Write concept, so copying a pixmap is not a heavy operation and actual data copy will happen only if you try to modify the original pixmap.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How could I make a UIImage move from the bottom of the screen, to
How could I stop the jerkiness in my hover it seems to move a
It seems that both of them could make the element move from its current
Could someone please suggest why this is happening... I’ve got some code to pretty
I've found some code that helps me resign the keyboard when a user touches
I am having some problems creating a loop that could show the cheapest price.
My boss recently asked me if I could move our website outside of the
do you have an idea, how the animated cats could move smoother? It's stuttering
I would like to move some files to a time-stamped directory after I transfer
Could someone know where is saved path to external XML-File that contain configuration for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.