Problem show in the link below:
http://postimg.org/image/sp9mm85qb/
I try to add this image in code
QIcon iconmain("qrc:/img/main.png");
ui->tabWidget->tabBar()->setTabIcon(1,iconmain);
Tried to add image from resourse file from disk. But it still invisible.
I assume the image is in the resource file with the prefix img, so you would access it without the qrc text prefix: -
QIcon iconmain(":/img/main.png");
Solved by changing msvs compil to mingv
Related
The below is my piece of code, I am not able to add background-image in my web page, can anyone tell me where I am going wrong?
enter image description here
Create folder called 'images' near your class_id.html file are located and Copy "Aravind_Signature.jpg" image to the newly created image folder
and then change the css background-image property as below
background-image:url("images/Aravind_Signature.jpg");
Note : its bad approach for referring image files path starting from drive names like "c:\". Because when you share your code you need change image path always.
There is nothing wrong, you just need to look at referring to path this way...
either use '/' or '\' so that you will get the right path.
My png image is located in src/AppBundle/Resources/public/img
I am trying to set png image through css content property:
content: url(../../public/assets/img/optional-checked.png);
But I am getting
GET http://127.0.0.1:8080/public/assets/img/optional-checked.png 404 (Not Found)
How can I set png image through CSS content property in Symfony project?
First suggestion, That's because you need to respect the hierarchy from where you call your CSS not your script.
Another suggestion would be not to use public folder to upload your assets, instead of this, use web folder (in the root), because if you do like I'm saying then the twig views can use properly asset keyword right.
And the last tip, is that you are trying to read your image from public/assets/img/optional-checked.png when you said that your image is really located in public/img.
Hope this helps.
I searched all over the internet for a solution for this, but found nothing.
Basicly I have a QLineEdit name 'le' (inside a class) whose background I want to set as an image. Using the code bellow, i get the error "Could not parse stylesheet of widget 0x1867580" and the image is not dispalyed.
self.le = QtGui.QLineEdit(self)
self.le.move(300,300)
self.le.setFrame(False)
self.le.setFixedWidth(100)
self.le.setStyleSheet("background: url:(Try.png)")
The Try.png image is a 100x20 px image, so it was supposed to fit that particular QLineEdit.
Does anyone have a clue about what might be going on?
Many thanks in advance,
Miguel
Try
self.ls.setStyleSheet("background-image: url(Try.png);")
but Try.png must be in folder from which Qt app started. Unless it is a resource, then
self.ls.setStyleSheet("background-image: url(:/images/try);")
where images is name of resource group
<qresource prefix="/images">
<file alias="try">Try.png</file>
</qresource>
then the image will be compiled into the app.
I've bundled some HTML and PNGs in my Qt app's resources file (for the help system). Unfortunately I can't find a way for the HTML to display images. I've tried various combinations of the QWebView's base URL, and different URLs for the <img> tag but none have worked so far.
To be clear, I want to be able to do something like this:
QString html = "<html><img href=':/resources/cat.png'/></html>";
myWebView->setHtml(html, ???);
Is this possible?
Try your resource format as:
qrc:/resources/cat.png
instead of
:/resources/cat.png
we have .css files that use images in such a format within webview and it works fine
i have a website #local and lots of images in site, but after I deploy site to server images paths are broken(exception given in css file), and I need to fix this as soon as possible.
sample path:
imageurl = #"/Images/sample.gif";
how can i fix this?
thank you.
you can set a appsetting in web.config file with server url like
and get this path on code and add image name with it.
Images (like background-url) in CSS are always referenced relative to the css file.
you need to set in css file like...
background-image: url( '../../Images/image.gif' );
.. this will bring out one folder from current folder hierarchy