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. .ico/cur plugin
Forum Updated to NodeBB v4.3 + New Features

.ico/cur plugin

Scheduled Pinned Locked Moved General and Desktop
11 Posts 4 Posters 5.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.
  • S Offline
    S Offline
    snowgirl
    wrote on last edited by
    #1

    Hello,
    I need help, with my faculty project which is about to make plugin that will support ico/cur format (can read and save these types of formats, in C++). Unfortunality, this is the first time that facing the experience with qt creator and plugins, so I don't really know how to do my project. Did someone do something similar with my topic? I desparately need help:)

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

      Have a look at this introduction, it may help:

      http://doc.qt.nokia.com/qq/qq17-imageio.html

      Mirko Boehm | mirko@kde.org | KDE e.V.
      FSFE Fellow
      Qt Certified Specialist

      1 Reply Last reply
      0
      • S Offline
        S Offline
        snowgirl
        wrote on last edited by
        #3

        thanx for the doc, it helped me a bit, but I have some missunderstandings yet.

        what does mean this line of code:

        @bool IcoHandler::canRead(QIODevice *device)
        {
        return device->peek(4) == "\xCA\xFE\x12\x34";
        }@

        1 Reply Last reply
        0
        • S Offline
          S Offline
          snowgirl
          wrote on last edited by
          #4

          that is for ARGB format, and which magic number will be for ICO format?

          1 Reply Last reply
          0
          • T Offline
            T Offline
            tobias.hunger
            wrote on last edited by
            #5

            Google for the ico format specification. That will have all the details you need to read and write the format.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              snowgirl
              wrote on last edited by
              #6

              I found that ico hasnt magic number. So, will it just be:
              @return device;@

              I know that these are tirvial questions, but I really never worked with Qt, esspecialy plugins and image formats.

              1 Reply Last reply
              0
              • C Offline
                C Offline
                cincirin
                wrote on last edited by
                #7

                Qt framework will call this function for every *.ico file, so if you are sure that every *.ico file can be read (i.e. doesn't have magic number), than just
                @
                return true;
                @

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  snowgirl
                  wrote on last edited by
                  #8

                  Another question is: can I use this function also in the case of .ico format (it is previously writen for raw format):

                  @bool IcoHandler::write(const QImage &image)
                  {
                  QImage result = image.convertToFormat(QImage::Format_RGB32);
                  QDataStream output(device());
                  quint32 width = result.width();
                  quint32 height = result.height();
                  output << width << height;
                  for (quint32 y = 0; y < height; ++y) {
                  QRgb *scanLine = (QRgb *)result.scanLine(y);
                  for (quint32 x = 0; x < width; ++x)
                  output << scanLine[x];
                  }
                  if ((width!=48 && height!=48) || (width!=32 && height!=32) || (width!=24 && height!=24) || (width!=16 && height!=16))
                  return false;

                  return output.status() == QDataStream::Ok;
                  

                  }@

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    cincirin
                    wrote on last edited by
                    #9

                    See "ico/cur file format":http://en.wikipedia.org/wiki/ICO_(file_format)#Outline

                    Edit: correct link is http://en.wikipedia.org/wiki/ICO_(file_format)#Outline
                    Maybe is a bug if link contains '#' character

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      snowgirl
                      wrote on last edited by
                      #10

                      yes, I saw that and many other documents related to these formats, but unfortunately, I don't know how to implement.

                      1 Reply Last reply
                      0
                      • T Offline
                        T Offline
                        tobias.hunger
                        wrote on last edited by
                        #11

                        Faculties tend to have teachers which -- based on my experience -- are happy to help when asked specific questions.

                        How about taking an .ico, converting it to e.g. png using any graphics application. Then you can have Qt read the png and feed that into your write method. If the output is identical to the original .ico file, then you are done. For the read method you can do something similar: You read the orginal file, compare that to the png.

                        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