Fixed menu error in CharSetViewer

This commit is contained in:
mlong 2021-02-01 21:40:40 -06:00
parent 7f4ca94e9a
commit 7002fc09ad
3 changed files with 36 additions and 21 deletions

View File

@ -6,8 +6,11 @@
CharSetViewer::CharSetViewer(QWidget *parent) : FileViewerInterface(parent)
{
m_file = Q_NULLPTR;
m_cse = Q_NULLPTR;
m_file = nullptr;
m_cse = nullptr;
m_showGridAction = nullptr;
m_enableBitShiftAction = nullptr;
m_charSetEncoderAction = nullptr;
QGridLayout *qgl = new QGridLayout(this);
setLayout(qgl);
@ -64,26 +67,34 @@ bool CharSetViewer::optionsMenuItems(QMenu *menu)
{
QSettings settings;
QAction *action = new QAction("Show &Grid",menu);
action->setCheckable(true);
action->setChecked(settings.value("CharSetViewer.ShowGrid",true).toBool());
if (!m_showGridAction)
{
m_showGridAction = new QAction("Show &Grid",menu);
m_showGridAction->setCheckable(true);
m_showGridAction->setChecked(settings.value("CharSetViewer.ShowGrid",true).toBool());
showGrid(settings.value("CharSetViewer.ShowGrid",true).toBool());
connect(action, &QAction::toggled, this, &CharSetViewer::showGrid);
menu->addAction(action);
connect(m_showGridAction, &QAction::toggled, this, &CharSetViewer::showGrid);
menu->addAction(m_showGridAction);
}
action = new QAction("&Enable Bit Shift",menu);
action->setCheckable(true);
action->setChecked(settings.value("CharSetViewer.EnableBitShift",true).toBool());
if (!m_enableBitShiftAction)
{
m_enableBitShiftAction = new QAction("&Enable Bit Shift",menu);
m_enableBitShiftAction->setCheckable(true);
m_enableBitShiftAction->setChecked(settings.value("CharSetViewer.EnableBitShift",true).toBool());
enableBitShift(settings.value("CharSetViewer.EnableBitShift",true).toBool());
connect(action, &QAction::toggled, this, &CharSetViewer::enableBitShift);
menu->addAction(action);
connect(m_enableBitShiftAction, &QAction::toggled, this, &CharSetViewer::enableBitShift);
menu->addAction(m_enableBitShiftAction);
}
if (!m_charSetEncoderAction)
{
menu->addSeparator();
action = new QAction("&Character Set Explorer...");
connect(action, &QAction::triggered, this, &CharSetViewer::showExplorer);
menu->addAction(action);
m_charSetEncoderAction = new QAction("&Character Set Explorer...");
connect(m_charSetEncoderAction, &QAction::triggered, this, &CharSetViewer::showExplorer);
menu->addAction(m_charSetEncoderAction);
}
return true;
}

View File

@ -46,6 +46,10 @@ private:
CharacterSet m_charset;
CharacterSetExplorer *m_cse;
QAction *m_showGridAction;
QAction *m_enableBitShiftAction;
QAction *m_charSetEncoderAction;
};
#endif // CHARSETVIEWER_H

View File

@ -234,8 +234,8 @@ void HiresScreenWidget::drawPixmap()
doubleScan = 1;
}
qDebug() << (byte & 0x01) << (byte & 0x02) << (byte & 0x04) << (byte & 0x08)
<< (byte & 0x10) << (byte & 0x20) << (byte & 0x40) << "HI: " << (byte & 0x80);
// qDebug() << (byte & 0x01) << (byte & 0x02) << (byte & 0x04) << (byte & 0x08)
// << (byte & 0x10) << (byte & 0x20) << (byte & 0x40) << "HI: " << (byte & 0x80);
pmpainter.setPen(xoff & 0x01?oddColor:evenColor);
pmpainter.setBrush(xoff & 0x01?oddColor:evenColor);