1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 17:28:50 -05:00

Created combo box without arrow

This commit is contained in:
f4exb 2018-07-01 11:07:37 +02:00
parent caf3559cdd
commit a2674fa9de
3 changed files with 74 additions and 0 deletions

View File

@ -14,6 +14,7 @@ set(sdrgui_SOURCES
gui/commanditem.cpp
gui/commandkeyreceiver.cpp
gui/commandoutputdialog.cpp
gui/comboboxnoarrow.cpp
gui/crightclickenabler.cpp
gui/cwkeyergui.cpp
gui/editcommanddialog.cpp
@ -73,6 +74,7 @@ set(sdrgui_HEADERS
gui/commanditem.h
gui/commandkeyreceiver.h
gui/commandoutputdialog.h
gui/comboboxnoarrow.h
gui/crightclickenabler.h
gui/cwkeyergui.h
gui/editcommanddialog.h

View File

@ -0,0 +1,33 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2018 F4EXB //
// written by Edouard Griffiths //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include <QPainter>
#include "comboboxnoarrow.h"
void ComboBoxNoArrow::paintEvent (QPaintEvent *ev __attribute__((unused)))
{
QPainter p;
p.begin (this);
QStyleOptionComboBox opt;
opt.initFrom (this);
style()->drawPrimitive (QStyle::PE_PanelButtonBevel, &opt, &p, this);
style()->drawPrimitive (QStyle::PE_PanelButtonCommand, &opt, &p, this);
style()->drawItemText (&p, rect(), Qt::AlignCenter, palette(), isEnabled(), currentText());
p.end();
}

View File

@ -0,0 +1,39 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2018 F4EXB //
// written by Edouard Griffiths //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef SDRGUI_GUI_COMBOBOXNOARROW_H_
#define SDRGUI_GUI_COMBOBOXNOARROW_H_
#include <QComboBox>
///////////////////////////////////////////////////////////////////////////////////////////////////
/// This class is a custom QComboBox which does NOT display the down arrow. The down arrow takes
/// a lot of real estate when you're trying to make them narrow. So much real estate that you can't
/// see short lines of text such as "CH 1" without the digit cut off. The only thing that this
/// custom widget does is to override the paint function. The new paint function draws the combo
/// box (using all style sheet info) without the down arrow.
///////////////////////////////////////////////////////////////////////////////////////////////////
class ComboBoxNoArrow : public QComboBox
{
Q_OBJECT
public:
ComboBoxNoArrow (QWidget *parent) : QComboBox(parent) {}
virtual ~ComboBoxNoArrow() {}
void paintEvent (QPaintEvent *ev);
};
#endif /* SDRGUI_GUI_COMBOBOXNOARROW_H_ */