buixuanan / fritzing

Automatically exported from code.google.com/p/fritzing
0 stars 0 forks source link

View menu should use standard check marks instead of icons to show selected options #2950

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Open the View menu
2. Notice that the menu has "dot" icons for selected view and bin view

What is the expected output? What do you see instead?

Should use standard "checked" menu items. On Mac, this is a check mark

What version of Fritzing are you using? On what operating system?

0.8.8 (from git)
Mac OS 10.9.2

Attached are 2 screen shots showing what it looks like now, and what it should 
look like (on Mac)

Original issue reported on code.google.com by rohan.ll...@gmail.com on 24 Apr 2014 at 4:32

Attachments:

GoogleCodeExporter commented 9 years ago
I have a fix for this at:

https://bitbucket.org/rohanl/fritzing/branch/issue_2950

Only built/tested on Mac

Original comment by rohan.ll...@gmail.com on 24 Apr 2014 at 4:45

GoogleCodeExporter commented 9 years ago
Thanks, indeed that's the right way to display it on Mac.
@Fabian, can you merge this?

Original comment by andre.knoerig@gmail.com on 24 Apr 2014 at 3:25

GoogleCodeExporter commented 9 years ago
Note: we went to some trouble originally to replace the checkmarks with the 
bullets, since these are more like radio buttons (which are exclusive), unlike 
check marks (from checkboxes) which are not.

That said, the bullets seem to be broken in qt 5. r549ddcc7ff28 is a fix, 
though not as elegant as Rohan's code.

Original comment by irasc...@gmail.com on 9 May 2014 at 8:06

GoogleCodeExporter commented 9 years ago
<quote>
Note: we went to some trouble originally to replace the checkmarks with the 
bullets, since these are more like radio buttons (which are exclusive), unlike 
check marks (from checkboxes) which are not.
</quote>

One big difference between my patch and 
https://code.google.com/p/fritzing/source/detail?r=549ddcc7ff28 is that I put 
the menu items in a QActionGroup, and set it to be exclusive.

This may make the items look like radio buttons depending on the platform/style.

However, this doesn't work because we have overridden so much of the default 
style. If you totally remove all styles, the interface looks horrible, but you 
can see the native look of the menus. This is what I've found:

Mac
---

Check marks are still used, and there is no visual difference between 
excusive/non-exclusive options. This is how native apps behave, so feels quite 
"normal" to me as a Mac user

Linux (Fritzing -style fusion)
------------------------

Exclusive items - radio button
Non-exclusive items - checkmark, square box

Linux (Fritzing -style gtk)
---------------------

Exclusive items - radio button
Non-exclusive items - checkmark, no box

So, on Linux, Qt gives you a radio button look for free.

So, in summary, I think we should:

1. Add QActionGroup for all radio groups. eg:

--- a/fritzing/src/mainwindow/mainwindow_menu.cpp
+++ b/fritzing/src/mainwindow/mainwindow_menu.cpp
@@ -35,6 +35,7 @@ $Date: 2013-04-28 14:14:07 +0200 (So, 28. Apr 2013) $
 #include <QSettings>
 #include <QDesktopServices>
 #include <QMimeData>
+#include <QActionGroup>

 #include "mainwindow.h"
 #include "../debugdialog.h"
@@ -1167,37 +1168,40 @@ void MainWindow::createViewMenuActions(bool 
showWelcome) {
        m_setBackgroundColorAct->setStatusTip(tr("Set the background color of this view"));
        connect(m_setBackgroundColorAct, SIGNAL(triggered()), this, SLOT(setBackgroundColor()));

+    QActionGroup *viewGroup = new QActionGroup(this);
+    viewGroup->setExclusive(true);
+
        QStringList controls;
        controls << tr("Ctrl+1") << tr("Ctrl+2") << tr("Ctrl+3") << tr("Ctrl+4") << tr("Ctrl+5");
        int controlIndex = 0;
        if (showWelcome) {
-               m_showWelcomeAct = new QAction(tr("&Show Welcome"), this);
+        m_showWelcomeAct = new QAction(tr("&Show Welcome"), viewGroup);
                m_showWelcomeAct->setShortcut(controls.at(controlIndex++));
                m_showWelcomeAct->setStatusTip(tr("Show the welcome view"));
         m_showWelcomeAct->setCheckable(true);
         connect(m_showWelcomeAct, SIGNAL(triggered()), this, SLOT(showWelcomeView()));
        }

-       m_showBreadboardAct = new QAction(tr("&Show Breadboard"), this);
+    m_showBreadboardAct = new QAction(tr("&Show Breadboard"), viewGroup);
        m_showBreadboardAct->setShortcut(controls.at(controlIndex++));
        m_showBreadboardAct->setStatusTip(tr("Show the breadboard view"));
     m_showBreadboardAct->setCheckable(true);
        connect(m_showBreadboardAct, SIGNAL(triggered()), this, SLOT(showBreadboardView()));

-       m_showSchematicAct = new QAction(tr("&Show Schematic"), this);
+    m_showSchematicAct = new QAction(tr("&Show Schematic"), viewGroup);
        m_showSchematicAct->setShortcut(controls.at(controlIndex++));
        m_showSchematicAct->setStatusTip(tr("Show the schematic view"));
     m_showSchematicAct->setCheckable(true);
     connect(m_showSchematicAct, SIGNAL(triggered()), this, SLOT(showSchematicView()));

-       m_showPCBAct = new QAction(tr("&Show PCB"), this);
+    m_showPCBAct = new QAction(tr("&Show PCB"), viewGroup);
        m_showPCBAct->setShortcut(controls.at(controlIndex++));
        m_showPCBAct->setStatusTip(tr("Show the PCB view"));
     m_showPCBAct->setCheckable(true);
     connect(m_showPCBAct, SIGNAL(triggered()), this, SLOT(showPCBView()));

     if (m_programView) {
-           m_showProgramAct = new QAction(tr("Show Code"), this);
+        m_showProgramAct = new QAction(tr("Show Code"), viewGroup);
            m_showProgramAct->setShortcut(controls.at(controlIndex++));
            m_showProgramAct->setStatusTip(tr("Show the code (programming) view"));
         m_showProgramAct->setCheckable(true);

2. Consider removing some of the excessive styling, such that Qt differentiates 
these natively.  Personally, I'd wind it back quite a bit, such that menus, 
dialogs, labels, text boxes etc are all native, with styling only being used to 
"brand" the app. eg keep "Fritzing red" on the major elements of the main 
window, etc.

However, that's just my opinion, and it's not my place to suggest major 
interface changes...

Original comment by rohan.ll...@gmail.com on 15 May 2014 at 3:30

GoogleCodeExporter commented 9 years ago
Issue has moved to new issue tracker at github. Please continue the discussion 
at https://github.com/fritzing/fritzing-app/issues

Original comment by andre.knoerig@gmail.com on 23 Sep 2014 at 3:44