CPropertySheet / CPropertyPage : Remove gaps - mfc

I'm trying to modify CPropertyPage, CTabCtrl, and CPropertySheet to obtain a fully customized appearance for the three component mentioned previously, But this is what I was able to achieve :
However Somethings just don't go along and I want to remove them, but I don't seem a find a way to do it.
So I would like to get some help and propositions on how to achieve the following changes :
Change the color of the title bar.
Remove the gabs between : CPropertyPage and CTabCtrl / CPropertySheet and CPropertySheet.
you will find below, an image describing the things I want to remove and modify.

Related

HScrollbar/VScrollbar in the Groupbox to group multiple buttons in MFC

I tried to include the VScrollbar/ HScrollbar. where i have placed the group of static text control[ i have to place around 10 static text ] in the group. But i unable to do.Even I will be happy if you can able to suggest any other way to place the Text control's and can be able to implement the scrollbar
I am using VS 2013 professional.
Thanks
Thanks for your reply. I feel sorry for not replying for your questions.
I implemented using custom draw clistctrl.
My job is to group list of static control and change the color based on the condition.
Initially I thought I should create individual control for everything and change the color based on the color control.
But I got the idea that how to use the clistctrl for my use.
Now I place all the texts in clistctrl and changing the color based on the condition.
Thanks

QTreeView: How to put multiple widgets in one cell?

I'd like to put multiple widgets in one cell of a QTreeView. QTreeView already does this with check boxes (e.g if you set ItemIsUserCheckable and ItemIsEditable). For example, how would I show a small tool button next to a line edit, instead of the check box next to the line edit?
I've gone through the whole deal of subclassing Qtreeview, implementing a custom ItemDelegate, and overriding paint( ) and createEditor( ). And that works if I only need to render simple things, like a single line edit, single button, etc. However, I cannot get it to work for nested components.
I tried to create a QHBoxLayout, add a QLineEdit and a QToolBarButton to it, add the layout to a new QWidget, and return the whole thing from createEditor( ). However, nothing shows up.
Can anybody provide a simple example?
Thanks!

create a scrollbar in a submenu qt?

I have a map application and a submenu which has dynamically added objects (i.e. points on a map) added to the submenu, depending on the layer that is loaded. I have the ability to hide each individual objects (i.e. a point) by clicking on the corresponding submenu item. Is there any way to organize the submenu? When there are a lot of points (i.e. 100) the entire submenu takes up the screen. Can I add a scrollbar to a submenu? I looked in the documentation, but couldn't find anything that support this feature.
From this bug report I was able to find out that you could do the following:
submenu->setStyleSheet("QMenu { menu-scrollable: 1; }");
Works like a charm.
There is no such possibility as far as I know.
Maybe you shouldn't use a sub menu for this but prefer a menu entry that show a Point manager GUI of your own which would have a QListWidget displaying all your points items.
I'm aware that this solution will break a (big?) part of your code but I don't see anything else.
I think you may be able to get the effect you want by creating and using your own QStyle subclass (via QApplication::setStyle()), and overriding the styleHint virtual method to return 1 when the StyleHint parameter passed in is SH_Menu_Scrollable. At least, that works for me when I create large QMenu objects and show them as popup menus.... It may also work for QMenus attached to the menu bar, but I havent tried that.
Whilst it is possible by subclassing the QMenu class to create a custom widget and going from there you're better off looking at a better way to display that information. You'll save yourself time and it'll be much easier for your users to not have to scroll through a big list of items in a small area.

Qt: How to show icon when item selected

I have a QListWidget containing items which have icons and when the items are selected the icon is just highlighted out. Is there a way to prevent this? I can't use stylesheets because it's for an embedded application and including them takes up too much space.
thanks
I suppose when you say "Highlithed out", you mean that the icon colors don't render well when the line is selected, and therefore, you can't see properly the icon...
Maybe you could consider using a different icon when the item is selected. It's possible to do so by specifing a mode to your icon.
Example :
QIcon MyIcon(":/images/foo");
MyIcon.addFile(":/images/bar", QSize(...), QIcon::Selected);
You can easily make a try in QtDesigner and see the results...
Hope it helps a bit !
Certainly, drawing on a black-and-white screen presents its challenges.
It sounds like you just want to change the appearance of the interface, not any functionality. If this is the case, a QItemDelegate-derived class (or QStyledItemDelegate) is almost certainly what you want. In particular, the drawDecoration function looks like it is used to draw an icon, and the style options should include whether it is selected. The simplest fix would be to override that function, set the selected flag in the options to false, then pass it up to the parent's function.

Which is preferred CTabCtrl vs. CPropertySheet in MFC?

I don't know how to use both of them. So a sample code with pros and cons is perfect. Which one is preferred? Why?
Neither is preferred, they serve different purposes. If you want a dialog with several pages, use a CPropertySheet. If you need a dialog with several pages while part of the dialog remains fixed, use a CTabCtrl. A CTabCtrl can be used do everything a CPropertySheet can do, but since the CTabCtrl is more complex to use, it shouldn't be used unless you need its extra flexibility. A CPropertySheet can also be used as a wizard by setting a few flags.
The following is an example of using a CTabCtrl:
aCTabCtrl Example http://rabien.com/image/xcolordialog1.png
If this was a CPropertySheet, then it would not be possible to put the sample colors outside of the tabs. (And the buttons would have to be at the bottom)
Tutorial on CPropertySheet
Tutorial on CTabCtrl