@Chris-Kawa turns out, you were spot on! I had some difficulties to compile my "fix" in release configuration.
So I went and rewrote the class, with your comment in mind. I intoduced a new signal and changed the overrides accordingly.
void signalEvent(QMouseEvent::Type t, QPoint p);
now, I don't need the timer, it also works in debug as well as in release mode...
in your Kobi class, add a setter method:
class Kobi : public ...
void setButtonWidget( QPushButton* button )
m_PushButton = button;
void Kobi::FullScreen ()
// OR EMIT A SIGNAL HERE AND CONNECT IT TO THE PUSHBUTTON'S hide() SLOT
if( m_PushButton )
Easiest would be when you could already create the button in this class?
Wow, it's works!
I couldn't find how resolve this problem, and I don't really know how to describe it.
Now I see I must learning some things about StyleSheet ;).
So, thank you for resolve my problem ;).
And thanks all of you guys for your time.
Topic is resolved.
which worked on the Image_Button, but instead the focus shifted on the submit button.
setDefault() or setAutoDefault() has no effect on submit. How can I make all of the buttons out of focus? Thank you.
(Since you are a Mod I applogize if this is breaking some kind of double post rule or an issue over becoming off topic)
Also, perhaps I should make a new topic, but there is one other thing I am stuck on now. I currently have a QTableWidget in my UI with three columns. I want the first two to be fixed in width, and all three to not be changeable by the user. The third column's width I want to be a little picky about though. I want it so that it can dynamically change size so that if text is put into it that is too large it will expand with a scroll bar instead of adding a second line to the cell, which I have accomplished with:
But the other condition is that I want it to always at least fill up the rest of the tables space so that there isn't a blank white area to the right of the column. Because if there is nothing in the cell and the above mode is applied the column width shrinks to the size of the header name "File Path" which is too small to take up the rest of the tables width. This normally can be accomplished by using:
but that cancels out the previous setting and makes it so that if the text gets too big a 2nd line in the cell is added (which I do not want) instead of the table gaining a scroll bar (which is what I want). So I figured, OK, all I need to do is leave it on "ResizeToContents" and then just set a minimum size so that it will dynamically resize the column but never become so small that it wont take up the whole table region. The problem I have is two fold.
First, the closest command I could find to do this is:
but the problem is there is no index argument so it seems that it will set a minimum size for all columns instead of just column 2. I cannot seem to find a solution that only affects one column.
Second, even if I can set a minimum size, the size is always an integer so I probably cannot get the minimum size set perfectly so that there is no visible space between the last column and the table right extent. Therfore it would be optimal if I could somehow have a "ReizeToContents"/"Stretch" hybrid that made it stretch to the table extent but resize dynamically only if the text gets too big for the cell. Basically, "Stretch" by default, but becomes "ResizeToConetents" if the cell text length hit the limit of the cell size. It doesn't look like this can be done however. I can think of a way to cause this behavior but it would be ugly:
Check the length of the cell text everytime a change is made (there is only one way for it to change so this isn't too hard)
Since the size of the table is fixed I can determine how many characters it would take to go over the cell size, which would normally cause a 2nd line to be added
Have the behavior default to stretch but change to ResizeToContents if the length of the text in the cell gets large enough that it would create a 2nd line.
The above should give the exact behavior I am looking for but I would prefer to not having to resort to that as it is ugly, feels inefficient, and seems unnecessary for something that looks like it could take 1-3 lines if I could find the right functions.
Does Qt have something to support this behavior or will I have to implement my awkward solution? I can take pictures if some of my explanations are unclear.
The reason for this design decision is probably that there was no other way to assure identical functionality across all platforms.
This design decision, if memory serves me, happened some time when Qt 4 was developed (which should be about 10 years ago) and it was mostly done because using native handles is costly as hell, and UIs tend to just eat up resources if you have a handle for each tiny thing. And it's been working just fine, if I may add.
The application runs in RAM, with all the qt dll useful for the deployment. Is it possible that a RAM corruption can cause a problem related to interface (font corruption, background image corruption...)?
@mrjj Thank you so much, for some reason I always forget I need to use the show() function...
Thank you for the help, and if you have any more suggestions please do comment or drop a line on my GitHub page. This is just my iniciation project, will be moving on to something larger soon. Thanks again!
After scouring the web, it appears that the only way to do this is the very complex technique of subclassing the widget. It's easier to just put another button on it, but then I had the problem where I couldn't pass a hover event to the QPushButton underneath it. This lead me to learn the technique on StackOverflow of building an eventFilter.
You can change the text or icon (setIcon()) as Chris mentioned. If you want to change the behavior you can have an if clause in the on_clicked() method. If you also want to change the color of the button you can use setStyleSheet().
Rather than putting a QToolBox in front of a QPushButton, it's better to put a QPushButton in front of a QComboBox, with the QPushButton covering all of the QComboBox except for the arrow on the right. This way, I retain all of the functionality of the QComboBox without having to reimplement it manually using QListView.
^^^ this issue persists. How do I create a new object in the dropEvent (to mimic 'moving' an object) and have it be created to the parent's widget? As it stands (with this as a parameter) it creates the new label on the widget that received the dropEvent.
@Hamed I had the same question and found this old thread. After thinking a while about this I had this idea:
Do it in an object oriented way! Define a sub-class of QPushButton which contains all the information you need to delete what you want. Add an "action" slot to your sub-class, connect this slot with the clicked() signal and do the delete in this
slot. Then instead of adding a QPushButton to the model add an object of your sub-class to the model!
Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.