Results 1 to 11 of 11

Thread: File icon to graphic view

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: File icon to graphic view

    I think your problem might be here:
    Qt Code:
    1. QPixmap(appIcon.pixmap(2,QIcon::Normal,QIcon::On))
    To copy to clipboard, switch view to plain text mode 
    First of all QIcon::pixmap() already returns QPixmap so invoking QPixmap constructor again is not necessary (but it is not an error). The strange thing in your code is that "2"... it means that you want and pixmap of size 2x2... not so big for me. Try changing it to 32 for example and check if it helps.
    For me this works fine:
    Qt Code:
    1. QString filename = QFileDialog::getOpenFileName(this,
    2. tr("Choose file..."),
    3. qApp->applicationDirPath());
    4. QIcon icon = fip.icon(QFileInfo(filename));
    5. scene->addPixmap(icon.pixmap(32, QIcon::Normal, QIcon::On))->setPos(50, 50);
    To copy to clipboard, switch view to plain text mode 
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

  2. #2
    Join Date
    Oct 2008
    Posts
    306
    Thanks
    6
    Thanked 9 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: File icon to graphic view

    Thanks! Sorry for the double post. I have a new issue on icon grabbing with diferrent file types, should I open a new thread?

Similar Threads

  1. Dropping file over app icon in MAC
    By dev_maximaa in forum Qt Programming
    Replies: 0
    Last Post: 20th March 2009, 05:40
  2. Obtaining a Windows file icon using fromWinHBITMAP()
    By DIMEDROLL in forum Qt Programming
    Replies: 2
    Last Post: 3rd October 2008, 11:50
  3. Setting OS Specified Icon on the File?
    By vishal.chauhan in forum Qt Programming
    Replies: 4
    Last Post: 31st May 2008, 12:37
  4. Set QApplication icon without using the rc/qrc file ?
    By Nyphel in forum Qt Programming
    Replies: 8
    Last Post: 23rd March 2007, 15:06
  5. set Icon to .app file
    By vishal.chauhan in forum Qt Programming
    Replies: 2
    Last Post: 10th January 2007, 21:13

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.