SVG wont load from qrc on Android
-
G'Day!
I am trying to get my old widget app going on Android, currently its working well on bb10 and linux desktop.
I made custom buttons for my QSpinboxes and QTabWidget to make them usable on the BB10 with svg images. They work great on the BB10 and the desktop but no joy on droid (Qt5.4 Droid 4.3).
I set them up via the QTabwidgets stylesheet from properties of the UI editor like this:
'
QDoubleSpinBox{
height:6ex;
}
QDoubleSpinBox::up-button {
width: 6ex;
background-color: "light grey";
image: url(:/prefix1/images/upArrow.svg);
}
QDoubleSpinBox::down-button {
width: 6ex;
background-color: "light grey";
image: url(:/prefix1/images/downArrow.svg);
}
QTabBar QToolButton {
border-width: 5px;
padding:6px
}
QTabBar QToolButton::right-arrow {
image: url(:/prefix1/images/rightArrowG.svg);
background-color: "light gray";
}
QTabBar QToolButton::left-arrow {
image: url(:/prefix1/images/leftArrowG.svg);
background-color: "light gray";
}
QTabBar::tab{
height: 6ex;
border: 2px solid #C4C4C3;
border-bottom-color: #C2C7CB; /* same as the pane color /
border-top-left-radius: 4px;
border-top-right-radius: 4px;
min-width: 8ex;
padding: 2px;
}
QTabBar::scroller{
width: 7ex;
border-width: 6ex;
}
QTabBar::tab:selected, QTabBar::tab:hover {
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #fafafa, stop: 0.4 #f4f4f4,
stop: 0.5 #e7e7e7, stop: 1.0 #fafafa);
}
QTabBar::tab:selected {
border-color: #9B9B9B;
border-bottom-color: #C2C7CB; / same as pane color */
}
'
And my .pro file looks like this:
[code]
#-------------------------------------------------Project created by QtCreator 2010-12-03T20:30:29
#-------------------------------------------------
QT += core gui widgets svg
TARGET = Bio_Brewers_tools
TEMPLATE = appSOURCES += main.cpp
biologger.cpp
aboutdialog.cppHEADERS += biologger.h
aboutdialog.hFORMS += biologger.ui
aboutDialog.uiCONFIG += qt
RESOURCES +=
bioCalc.qrc
RC_FILE = bioLogger.rcOTHER_FILES +=
bar-descriptor.xml
[/code]
(What happened to the code tags buttons etc?)
But the images never get loaded, the spinboxes do not appear at all and the tab's on the tabWidget are collapsed I assume all due to the images not getting loaded.
Any insight or advice as to where I am going wrong here would be appreciated!
Cheers,
Jon -
Well it appears its the code in my stylesheet that is causing the problem, not the svg images after all.
If I remove the stylesheet code altogether it runs fine on the droid with the same ol Qt widget styling.
If I edit out the svg images from the stylesheet it behaves the same way as above in that the tabs and spin boxes don't appear.
Can anybody see whats wrong with my style sheet code above when it comes to Android?
Perhaps its because I am implementing it from the UI editor for the tab widget and I should be implementing it from main.cpp as I see is sometimes recommended while I was researching this problem? Grasping at straws here... :)
Perhaps this is a bug...
Cheers,
Jon -
Bug filed.
https://bugreports.qt.io/browse/QTBUG-45517
Cheers,
Jon