Author

Topic: How to increase the size of icons in QToolbar? (Read 174 times)

legendary
Activity: 4326
Merit: 3041
Vile Vixen and Miss Bitcointalk 2021-2023
January 19, 2019, 06:09:45 AM
#11
For the benefit of anyone from the future finding this thread after having a similar problem, what "actually worked" was using QSize instead of int(s):
Code:
toolbar->setIconSize(QSize(128, 128));

(Hint: when the compiler tells you one part of a statement/expression is wrong, try changing only the wrong part instead of other parts that may have been right the first time.)
sr. member
Activity: 630
Merit: 256
Code:
qt/bitcoingui.cpp:563:9: note: suggested alternative: ‘toolbar’
         toolBar->setIconSize(QSize(128, 128));
         ^~~~~~~
         toolbar
As the compiler suggestion suggests, names are case sensitive.

Yeah, I also tried doing that, then it gives the following:

Code:
qt/bitcoingui.cpp: In member function ‘void BitcoinGUI::createToolBars()’:
qt/bitcoingui.cpp:563:37: error: no matching function for call to ‘QToolBar::setIconSize(int, int)’
         toolbar->setIconSize(100,100);
                                     ^
In file included from /root/source_code/depends/i686-w64-mingw32/share/../include/QtWidgets/QToolBar:1:0,
                 from qt/bitcoingui.cpp:61:
/root/source_code/depends/i686-w64-mingw32/share/../include/QtWidgets/qtoolbar.h:170:10: note: candidate: void QToolBar::setIconSize(const QSize&)
     void setIconSize(const QSize &iconSize);
          ^~~~~~~~~~~
/root/source_code/depends/i686-w64-mingw32/share/../include/QtWidgets/qtoolbar.h:170:10: note:   candidate expects 1 argument, 2 provided
Makefile:7546: recipe for target 'qt/qt_libprontoqt_a-bitcoingui.o' failed
make[2]: *** [qt/qt_libprontoqt_a-bitcoingui.o] Error 1
make[2]: Leaving directory '/root/source_code/src'
Makefile:10568: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/root/source_code/src'
Makefile:688: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

Tried doing "setIconSize(100);" instead of "setIconSize(100,100);" and it gives the same result.

My bad! Actually it did work! Thanks for the help guys, I really appreciate it. I'm trying to learn some QT myself, so I really appreciate the help you've given! Smiley
sr. member
Activity: 630
Merit: 256
Code:
qt/bitcoingui.cpp:563:9: note: suggested alternative: ‘toolbar’
         toolBar->setIconSize(QSize(128, 128));
         ^~~~~~~
         toolbar
As the compiler suggestion suggests, names are case sensitive.

Yeah, I also tried doing that, then it gives the following:

Code:
qt/bitcoingui.cpp: In member function ‘void BitcoinGUI::createToolBars()’:
qt/bitcoingui.cpp:563:37: error: no matching function for call to ‘QToolBar::setIconSize(int, int)’
         toolbar->setIconSize(100,100);
                                     ^
In file included from /root/source_code/depends/i686-w64-mingw32/share/../include/QtWidgets/QToolBar:1:0,
                 from qt/bitcoingui.cpp:61:
/root/source_code/depends/i686-w64-mingw32/share/../include/QtWidgets/qtoolbar.h:170:10: note: candidate: void QToolBar::setIconSize(const QSize&)
     void setIconSize(const QSize &iconSize);
          ^~~~~~~~~~~
/root/source_code/depends/i686-w64-mingw32/share/../include/QtWidgets/qtoolbar.h:170:10: note:   candidate expects 1 argument, 2 provided
Makefile:7546: recipe for target 'qt/qt_libprontoqt_a-bitcoingui.o' failed
make[2]: *** [qt/qt_libprontoqt_a-bitcoingui.o] Error 1
make[2]: Leaving directory '/root/source_code/src'
Makefile:10568: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/root/source_code/src'
Makefile:688: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

Tried doing "setIconSize(100);" instead of "setIconSize(100,100);" and it gives the same result.
legendary
Activity: 4326
Merit: 3041
Vile Vixen and Miss Bitcointalk 2021-2023
Code:
qt/bitcoingui.cpp:563:9: note: suggested alternative: ‘toolbar’
         toolBar->setIconSize(QSize(128, 128));
         ^~~~~~~
         toolbar
As the compiler suggestion suggests, names are case sensitive.
sr. member
Activity: 630
Merit: 256
This should be set in somewhere here, right?
Yes. Do it right after the toolbar is created.

Hmm, tried couple ways, but then it fails to compile when compiling bitcoingui.o

Running autogen.sh now, but not sure if that could fix the problem.

---

Nope, running autogen.sh did not fix that, still get the following:

Code:
qt/bitcoingui.cpp: In member function ‘void BitcoinGUI::createToolBars()’:
qt/bitcoingui.cpp:563:9: error: ‘toolBar’ was not declared in this scope
         toolBar->setIconSize(QSize(128, 128));
         ^~~~~~~
qt/bitcoingui.cpp:563:9: note: suggested alternative: ‘toolbar’
         toolBar->setIconSize(QSize(128, 128));
         ^~~~~~~
         toolbar
Makefile:7546: recipe for target 'qt/qt_libprontoqt_a-bitcoingui.o' failed
make[2]: *** [qt/qt_libprontoqt_a-bitcoingui.o] Error 1
make[2]: Leaving directory '/root/source_code/src'
Makefile:10568: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/root/source_code/src'
Makefile:688: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

Tried some other ways:

Quote
qt/bitcoingui.cpp: In member function ‘void BitcoinGUI::createToolBars()’:
qt/bitcoingui.cpp:563:17: error: expected unqualified-id before ‘->’ token
         QToolBar->setIconSize(100,100);
                 ^~
Makefile:7546: recipe for target 'qt/qt_libprontoqt_a-bitcoingui.o' failed
make[2]: *** [qt/qt_libprontoqt_a-bitcoingui.o] Error 1
make[2]: Leaving directory '/root/source_code/src'
Makefile:10568: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/root/source_code/src'
Makefile:688: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1
staff
Activity: 3374
Merit: 6530
Just writing some code
This should be set in somewhere here, right?
Yes. Do it right after the toolbar is created.
sr. member
Activity: 630
Merit: 256
Ah, I was mistaken. You are using the QIcon class for your icons. The size of the displayed icon is determined by the current active style. For a QToolbar, the size of an icon is default to 24x24. You can change this by using QToolBar::setIconSize(). I think that should work.

Thank you!

This should be set in somewhere here, right?

staff
Activity: 3374
Merit: 6530
Just writing some code
Ah, I was mistaken. You are using the QIcon class for your icons. The size of the displayed icon is determined by the current active style. For a QToolbar, the size of an icon is default to 24x24. You can change this by using QToolBar::setIconSize(). I think that should work.
sr. member
Activity: 630
Merit: 256
Hi. Thanks for the answer. Yes, I'm using 128x128 PNG actually. Also, I've noticed that even the standard PNG's are 32x32, while when the wallet is opened, it's 24x24, no matter what size PNG you have in the folder.
staff
Activity: 3374
Merit: 6530
Just writing some code
Have you tried making bigger source images for the icons? IIRC the source images make that size. The icons are in src/qt/res/icons
sr. member
Activity: 630
Merit: 256
Maybe anyone will know, how do I increase the icon size on QToolbar?

I've found how to remove the text and I want to see a bit bigger icons. I've done some changes, but only the toolbar itself has grown in size. Icons of QToolbar stay at 24x24 px. I tried searching the code, but I just couldn't find it... Maybe anyone knows?

Jump to: