QtWidgets should learn from ExtJS.
About alignments and other such things. As for me stylization (via QStyle and stylesheets) is flexible enough. Just simply can't say what you cannot do with them and what is presented in ExtJS.
(About alignments and other such things)
As I said before, I know this functionalities can be accomplished with Qt reimplementing QStyle and such things. I just don't see why can't it be simplier: by setting a property.
And what about the rest?
I'm not a troll, so I can't say about the reasons, but as from my point of view a lot of properties (for this, for that, for something else) can destabilize the API. API will be huge and near to not-understandable and it can lead to a lot of errors inside the framework. Just keeping things simplier and divided from each other helps in this two cases a lot.
About pushbutton and toolbutton (again from my point of view). Action is something from menu/toolbar/context menu/shortcutted macro and so on that changes current view. Pushbutton is something that switches to another view.
Also for full flexibility you can look into Quick and future Components.
Making QPushButton and QToolButton the same would decrease API size. Instead of 2 different classes you would have only one, with both functionalities. And would be even more usefull.
A button is a button. Whether it is on a Toolbar or not. The functionality is the same, or at least it should be.
Yes, I'm aware of QtQuick and I think it is a great project. But still it's not the best for Desktop applications where you want your App to integrate with the OS Look & Feel.
I am currently working on a project using Qt. I will provide my applications with the things I said before. I just think that if QtWidgets were more flexible I wouln't have to reimplement most of the widgets. I mean, I know a Toolbar is suposed to be on a MainWindow, but why restrict it? Same for Status bar. Same for buttons, and tool buttons. It just seems like a huge amount of Qt wasted.
For instance, look at this thread: "I want make custom List Item":http://developer.qt.nokia.com/forums/viewthread/1478/
Someone replied, I quote:
bq. Well, forget QListView.
It’s the last thing you want..
All you have to do is to create a new widget class. Then you create a layout class to layout the widgets in vertical or whatever you want.
Why??? It seems like Widget are programed to be used in a specific way. And if you want to do something else you need to create your own widget.
I find QtCore a very solid framework, but if it were up to me I'll chose ExtJS for the UI. Of course, not every project can be a Web Application. When it comes to C++ Qt is the best UI framework, but it doesn't mean it is perfect. I still miss most of ExtJS functionalities.
Well, anyway.. I was just making a suggestion. It is ment for the people who made QtWidgets and the people who are constantly trying to improve them. And it is a suggestion from a developer who has worked with different UI APIs and who have seen and experienced different features that could improve this particular API. It's up to those people to do something or not.
If you can make good proposal (with strict descriptions how do you see these things or other) it will be good to push it to bugreports. Of course, you will not see it in Qt4 (because of ABI compatibility), but all can be in case of Qt5. If you will do it, post a link here, please.
Well, I am working on a project that will have most of this features, eventually. But right now we are working on the backend. When the time is right I will post the first version of this new List+Tree+Grid view.
As of the PushButton and ToolButton, just found this in the BugTracker:
"Allow QAction to take over a QAbstractButon":http://bugreports.qt.nokia.com/browse/QTBUG-7994 that someone else created.
Should I create a new ticked? Just take a look to what I commented.
Ok, I made a bugreport regardling QPushButton and QToolButton.
I leave the link here for future references "Remove QToolButton and Improve QPushButton instead.":http://bugreports.qt.nokia.com/browse/QTBUG-14785
If anyone else is interested in this please vote.
Looking forward to see trolls answer.
[quote author="kkrzewniak" date="1288252339"]QPushButton and QToolButton are totally different scope. Leave them as they are. In my opinion the power of Qt is that You can always write your own widget that will have some custom behaviour. I just think that your idea would lead to API bloating. [/quote]
You'll end up having one class, and less repeated code. AND that class will be more powerfull as it is now.
So no, I don't think it would lead to API bloating. In fact, exactly the opposite. But that's not the point. The point is satisfying a need: Let QPushButton bind with QActions. AND improve the personalization of a QPushButton instance. Maybe it's not YOUR need specifically, but it would make a lot of people's code simplier.
Besides, Qt has always been taking advantage of Web application's style of doing things. For instance, Widgets stylesheets.. or QML. So.. 8-)
Do You know of a thing called sub-classing. Both QPushButton and QToolButton are subclasses of QAbstractButton(not a lot of duplicated code now is there). If it makes Your code simpler just write your own QAbstractButton subclass. And I personally think it would be a waste of Trollpower, when you should be capable of implementing such a class your self.
Don't get me wrong I'm not against taking some good things from other worlds. But your idea of merging QPushButton and QToolButton, because you think they duplicate each others code, come on.
The thing that got me going the most was actually your thread title.
Today QPushButton and QToolButton don't have too many duplicated lines of code, that's because they aren't complex classes. The only functionality I can think of being repeated is setMenu() and menu() and that's what I meant by saying less repeated code.
But if QToolButton were merged into QPushButton (and QAbstractButton),
You will be able to bind a QAction to a QPushButton (or any QAbstractButton if that functionality is implemented into the abstract class). That would be a good improvement to QPushButton (and another reason to merge classes).
I don't know why QActions aren capable of taking over a QAbstractButton today, I think that's something that the Trolls have missed.
I see now it's no use to suggest something. I only meant to suggest something to improve Qt, cause I like Qt. I know there are more urgent fixes.. but still.
I'm not entirely sure what You mean by merging. If you mean that the Trolls need to drop QToolButton and QPushButton and add a new class than that simply would be braking backward compatibility. But If You mean adding a new class that would have the functionality of both, than I can see this being some thing that could be added to Qt. But than why don't you write it your self and try making a contribution to Qt.