I am attempting to get a QLabel display an image and some text centered vertically with that image.
I can't figure out how to do this.
Most sources I've found on the internet suggest using the following code:
ui->label->setText("<img src='c:/images.jpg' style='vertical-align:middle;'> Hello");
However what I get is this.
The bottom line of the text is centered near the image, but what I like to have is the middle line of the text to be centered (like so: made in ms paint). Sounds like a pretty common task yet I wasn't able to find any answer.
How can I achieve this?
I tried to run it in my QtCreator and it work fine. So, for start, you can try the following:
Check the picture size. Open it in paint.net or something like that. Perhaps the top image is an empty area of the invisible. Those, the actual size of the image looks like an elongated rectangle, in which the visible part is on the bottom. Try other image.
Try to change the format jpg to png. I had problems with displaying images in jpg format, so I always try to use the png.
Problems with styles. Qt may work incorrect with css style, because it not part of the Qt. I tested in version Qt 5.4.0. If you have an older, may be its time to update it.
Related
I've designed and coded an interactive SVG that I've had to implement as HTML in WordPress because it only acts as a useless static image if it's entered as an SVG in an image block.
So far, that means that it's not responsive and loads at full size on a phone. I want people to see it in full, straight away, not zoom out to see it.
Is there another way to make it work without being an HTML dump? And even as code, how would I reduce it to fit screen sizes? Bearing in mind that my brain may implode if you suggest coding breakpoints or something like that.
I'm using a Blocksy child theme with no page builder.
The code itself works fine so there seems no point in me pasting a shortened version of the code. The page is here, if that helps.
Www.orderaround.co.uk
Right, I've fixed it myself. All I needed to do was remove the width and height specifications from the beginning of the svg code. It now fits to whatever container it's being displayed in.
I am looking for a image library with React. What I want to do is that there is a fixed editor and I can move and resize the image behind the editor and if the image in the editor is what I want, then I get fixed image's baseUrl. I found a few libraries, but those are only giving cropped function not moving or resizing image. I hope to find out cropped image library plus that can move or resize image.
Check out https://www.npmjs.com/package/react-avatar-editor
Sounds like what you're describing, including the base64 export.
There is a lot of packages around, the most recommended one is react-avatar-image-cropper.
Have a look at it: https://www.npmjs.com/package/react-avatar-image-cropper
Why do images on the web load line by line? Why not from top left pixel to bottom right pixel? Is it about browser or css defaults? Is it possible to change that to show pixels at the moment they are loaded or after whole image is loaded?
It has to do with the order they appear in the html document. The positioning in the page, doesn't matter in the loading priority.
You can with Javascript or JQuery, like this:
$("#img").hide();
$('#img').load(function(){
$('#img').show();
});
Basically it shows the image only if the whole image is loaded.
You are talking about how exactly the image itself is loaded/rendered? It's a mix of:
implementation detail in each browser
how the image is formatted (which format, gif/jpeg/png
Can you control it using CSS? No, not really. You might do some effects using CSS animations/transitions, but not pixel by pixel. Not in an efficient manner at least.
It depends on image format, some can load line by line, some are "progressive" and can load in "chunks" (firs a blurry, pixelated image is visible, then it loads some more data and becomes less blurry, and so on), some have to load in full before they can be displayed.
At the moment, I am programming a little map editor for my 2D-RPG game.
All functions are successfully implemented, but my problem is, that the textures for each cell in my QTableWidget aren't stretched to the full size of 32x32. I have already changed the sizeHint settings, but it doesn't work.
Here a little picture about my problem.
As you can see, in each cell are a white background and the textures aren't fully stretched. Actually I load the textures over the setIcon function, maybe an other way exists to load images in a cell? How can I fix it, for stretching to the full size of 32x32?
Try to style the icon or see where its padding/margin gets defined.
If you take a peek at the page I'm trying to create, here, you'll see the issue I'm having pretty quickly. I can't figure out why my send button isn't lined up or sized properly. I've tried changing the height and width of the button, and I've tried adding a bottom margin. The next thing I'm going to try is to change the line height, for the size. I'm more worried about not getting everything aligned, though. As long as everything lines up, it looks nice to me. Can someone help me figure out why it isn't aligned? Also, please ask if you need any additional details.
I've also tried display:inline; and various float settings.
You need to float both the .button_outside_border and the .status_text to the left like in this example. You still have a bit of cleaning up do to get it pixel perfect but this should get you underway.