Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    1. Home
    2. Tags
    3. icon
    Log in to post

    • SOLVED How to get icon from any file?
      General and Desktop • icon • • AndrzejB  

      3
      0
      Votes
      3
      Posts
      955
      Views

      2 works, thanks! But why 1 icon isNull() ? Is possible 1 and 2 under Linux? Linux has something like mime or/and Elf binaries can holds icons? Bad: QPixmap extractMime(const QString &sourceFile) { QMimeDatabase mime_database; const QString nativeName = QDir::toNativeSeparators(sourceFile); QIcon icon; QList<QMimeType> mime_types = mime_database.mimeTypesForFileName(nativeName); icon = QIcon::fromTheme(mime_types[0].iconName()); if (icon.isNull()) qDebug() << "null"; qDebug() << mime_types[0].iconName(); return icon.pixmap(16); } Maybe this work for Linux, but for Windows I need registers. Sample C# application https://www.codeproject.com/Articles/29137/Get-Registered-File-Types-and-Their-Associated-Ico for example: Computer\HKEY_CLASSES_ROOT.mp3 has OpenWithProgIds/WMP11.AssocFile.MP3 Computer\HKEY_CLASSES_ROOT\WMP11.AssocFile.MP3 has DefaultIcon = %SystemRoot%\system32\wmploc.dll,-732 wmploc.dll is resources and 732 index of icon?
    • UNSOLVED How to set Task Bar icon depending on state of Qt app?
      General and Desktop • windows 10 msvc2015 icon innosetup • • michalos  

      1
      0
      Votes
      1
      Posts
      577
      Views

      No one has replied

    • SOLVED TreeView Hide Column hides the expand / collapse icon and prints plain Table
      General and Desktop • treeview icon column expand symbol • • Opa114  

      3
      0
      Votes
      3
      Posts
      1087
      Views

      Good to know, so my solution to store this in the last column and hide this one is the best solution for me.
    • SOLVED QListWidget with dynamic icons
      General and Desktop • qlistwidget icon qlistwidgetitem • • Harry123  

      12
      0
      Votes
      12
      Posts
      3829
      Views

      It's good when it's more friendly :)
    • UNSOLVED How to add icon without a text into QListWidget?
      General and Desktop • icon listwidget no text • • IL  

      10
      0
      Votes
      10
      Posts
      4488
      Views

      @IL you can add a widget to an item. So just create a for example frame that contains your icon and add it to the list item. QListWidget *list = new QListWidget(this); //... QFrame *custom = new QFrame; //add whatever you need to the frame QListWidgetItem *i = new QListWidgetItem; list->addItem(i); list->setWidgetItem(i,custom); I used this for a list where each item needed several buttons to get for example detailed information about the item or delete the item from the list with one click
    • UNSOLVED QToolbar on OSX: no hover effect
      General and Desktop • desktop os x qtoolbar icon qaction • • Xanx  

      5
      0
      Votes
      5
      Posts
      1635
      Views

      Please have some patience, this forum is community driven and not all users live in the same timezone as you. The picture you are linking to doesn't show a hovered button but a checked button. You will have that visual effect if you set the checkable property of the action to corresponding to the button as true and you check it.
    • Help with info.plist
      Mobile and Embedded • ios icon status bar info.plist • • VictorKoenders  

      1
      0
      Votes
      1
      Posts
      512
      Views

      No one has replied

    • How To Style QPushButton Icon?
      General and Desktop • qt5.5 stylesheet qpushbutton icon style position positioning • • maximo  

      8
      0
      Votes
      8
      Posts
      7360
      Views

      @maximo Agree. I wonder if there is something secret I missed in some Doc.
    • Display icon into QLabel [SOLVED]
      General and Desktop • c++ linux qlabel icon • • marlenet15  

      4
      0
      Votes
      4
      Posts
      11097
      Views

      Something like: QIcon icon = style()->standardIcon(QStyle::SP_DialogOkButton); QPixmap pixmap = icon.pixmap(QSize(64, 64));
    • How to make default icon bigger when button changes size? [SOLVED]
      General and Desktop • c++ linux button icon size • • marlenet15  

      2
      0
      Votes
      2
      Posts
      1189
      Views

      @marlenet15 See the docs : http://doc.qt.io/qt-5/qabstractbutton.html#iconSize-prop
    • Set icon to QTreeWidgetItem causes crash
      General and Desktop • crash icon qtreewidgetitem • • MohammadReza  

      12
      0
      Votes
      12
      Posts
      4012
      Views

      What is the stack trace when this happens ?
    • [SOLVED] QPushButton and Icon -- How To Move Icon More To The Left?
      General and Desktop • qpushbutton icon qproperty styling • • maximo  

      2
      0
      Votes
      2
      Posts
      7312
      Views

      After scouring the web, it appears that the only way to do this is the very complex technique of subclassing the widget. It's easier to just put another button on it, but then I had the problem where I couldn't pass a hover event to the QPushButton underneath it. This lead me to learn the technique on StackOverflow of building an eventFilter.
    • QToolBar - real Icon Size / Minimum Size
      General and Desktop • qtoolbar size icon qaction icons sizepolicy sizehint • • Cluosh  

      2
      0
      Votes
      2
      Posts
      1789
      Views

      The thing is that toolbars don't really display icons. They display widgets (that can have icons). By default when you add an action to a toolbar a QToolButton is created for it, but you are not limited to that and can add any widget e.g. an expanding line edit, combobox or a button with an icon and text. All of these can have different size policies, be expanding or have a custom stylesheet applied. All of this makes calculating such size not feasible because how would you calculate it if a widget can change its size. What I'm saying is that yours is a special, very specific case (with just icons), and as such you need to handle it yourself if you want to. To answer your questions: It's not one thing that adds the space. There are couple of aspects that can contribute. You can control some(or all?) of them with stylesheets e.g. set padding of the toolbar and toolbuttons to 0 and margins and borders of the toolbuttons. By default all of these depend on a style and will vary across computers. You also need to be careful to consider the size of the toolbar handle (if it's movable) as its size depends on the active style. You also need to consider that if the icon is narrower than the iconSize then there's gonna by space left anyway. nope, AFAIK it can vary from one item of the toolbar to another if you set it this way nope and just out of curiosity - why do you need that? The bar will display an arrow button that will let you see the overflowing items. Also such calculated size would be useless as the window can be resized and thus the toolbar too (unless you're doing some really fancy layout).
    • [SOLVED] Set table view column full of clickable icons
      General and Desktop • qtableview icon icons • • mkolenda  

      2
      0
      Votes
      2
      Posts
      1321
      Views

      Hi I would say a Delegate would be the way to do it. Have a look at "Star Delegate Example" For your fancy hand, you can use QApplication::setOverrideCursor(QCursor(Qt::PointingHandCursor)); QApplication::restoreOverrideCursor(); Its also possible via the model http://daniel-albuschat.blogspot.dk/2009/09/setting-mouse-cursor-for-qts-item-views.html
    • Adding Icon on top of Text in a QPushButton
      General and Desktop • qpushbutton icon top • • Pranjal Jain  

      2
      0
      Votes
      2
      Posts
      2728
      Views

      Hi and welcome to devnet, Why not just call setIcon with your current icon ? No need for a style sheet
    • [SOLVED] QSystemTrayIcon icon from resource file isn't showing
      General and Desktop • icon resource qsystemtrayicon • • nitzan  

      26
      0
      Votes
      26
      Posts
      9843
      Views

      Good, glad ya got it sorted out. Sorry I've been super busy lately and haven't lurked the forums here. :)
    • Get icon for .url files on Windows
      General and Desktop • windows icon • • hinst  

      1
      0
      Votes
      1
      Posts
      683
      Views

      No one has replied

    • Qt icons
      General and Desktop • icon • • Annili  

      1
      0
      Votes
      1
      Posts
      402
      Views

      No one has replied

    • QPushButton icon auto resize
      General and Desktop • resize qpushbutton icon automatic • • Romain C  

      2
      0
      Votes
      2
      Posts
      2971
      Views

      After all this time, I don't fin a way to do it properly. I'm using QML and it's fine now. For people intereested in, this is my QML component: import QtQuick 2.5 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 Button { property color backgroundColor property alias tooltip : buttonAction.tooltip property string imageSource signal buttonClicked ( ) action : buttonAction activeFocusOnPress : true Keys.onPressed : { if ( (event.key == Qt.Key_Return||event.key == Qt.Key_Enter) && activeFocus) { buttonClicked ( ); event.accepted = true; } } style : ButtonStyle { background: Rectangle { id : backgroundRectangle color : backgroundColor Rectangle { id : roundedRectangle color : control.pressed?Qt.darker(backgroundColor, 1.1):backgroundColor anchors.fill : parent radius : 10 scale : ( control.hovered||control.activeFocus )?1:0.9 Image { id : buttonImage anchors.fill: parent fillMode : Image.PreserveAspectFit source : imageSource } } } } Action { id : buttonAction onTriggered : buttonClicked () } }
    • ToolButton iconSource Size doesn't fill button Size on Android
      QML and Qt Quick • icon toolbar • • didu  

      1
      0
      Votes
      1
      Posts
      743
      Views

      No one has replied

    • Icon Dialog
      QML and Qt Quick • dialog icon • • didu  

      11
      0
      Votes
      11
      Posts
      5121
      Views

      @didu You're Welcome :) Happy Coding...
    • Set Icon of my .exe File
      General and Desktop • icon • • max-253yomann  

      6
      0
      Votes
      6
      Posts
      8082
      Views

      Deleting the output directory and rebuilding does not work. Now I created a new project and now it works. Thank You :)