Qt Designer Plugin get location of project folder
-
Does anyone know how to get the directory of the current project to use with a Qt Designer Plugin?
The problem I am trying to solve:
I have a plugin that loads a "css" file into the form using:
auto* form_window = QDesignerFormWindowInterface::findFormWindow(static_cast<QStackedWidget*>(this)); QFile file(":css/custom.css"); file.open(QIODevice::ReadONly); QString css = file.readAll(); form_window->setStyleSheet(css);
This makes it so I can have one style sheet and keep it as its own file, making the style much easier to maintain.
This works great, but if I change the css file, I have to close and re-open designer to get the new css. I tried adding a watch to the ":css/custom_css" but it seems watching a resource path (i.e. using ":/...", with the resource in a "resources.qrc" file) does not work, as nothing happened when I changed the css file.
To solve this, I want to watch the actual css file and not the "resource".
If someone knows a better way of achieving what I want, I am all for that too.