Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QtConcurrent scaling image
Qt 6.11 is out! See what's new in the release blog

QtConcurrent scaling image

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 1.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hneis
    wrote on last edited by
    #1

    Hello everyone. Help make out what the problem is.
    He took an example of Image Scaling working:
    @QImage scale (const QString & imageFileName)
    {
         QImage image (imageFileName);
         return image.scaled (QSize (imageSize, imageSize), Qt :: IgnoreAspectRatio, Qt :: SmoothTransformation);
    }

    void Images :: open ()
    {
    ...
         QStringList files = QFileDialog :: getOpenFileNames (this, tr ("Select Images"),
                                 QStandardPaths :: writableLocation (QStandardPaths :: PicturesLocation),
                                 "*. jpg *. png");

    ...
         imageScaling-> setFuture (QtConcurrent :: mapped (files, scale));
    ...
    }@

    But if you do so. falls with error

    @QImage scale (const QString & imageFileName)
    {
         QImage image (imageFileName);
         return image.scaled (QSize (imageSize, imageSize), Qt :: IgnoreAspectRatio, Qt :: SmoothTransformation);
    }

    void Images :: open ()
    {
    ...
         QStringList files;
         files.append (QString ("path to file"));
         files.append (QString ("path to file2"));
         files.append (QString ("etc"));

    ...
         imageScaling-> setFuture (QtConcurrent :: mapped (files, scale));
    ...
    }@

    if you add in QStringList path to a single file, it works too

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on last edited by
      #2

      bq. But if you do so. falls with error

      What kind of error?

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mostmore
        wrote on last edited by
        #3

        can't figure out what the problem is, can you give us some more details. i have "image scaling sample codes":http://www.rasteredge.com/how-to/csharp-imaging/scale-image/ found for you on the google, you may take a lookt, hope it is helpful for you.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved