code format
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "chardialog.h"
|
||||
|
||||
#include "ui_chardialog.h"
|
||||
|
||||
|
||||
@@ -11,20 +12,18 @@ CharDialog::CharDialog(QWidget * parent): QDialog(parent) {
|
||||
for (int j = 0; j < 256; ++j) {
|
||||
c = QChar(j, i);
|
||||
k = c.category();
|
||||
if (chars.size() <= k)
|
||||
chars.resize(k + 1);
|
||||
if (chars.size() <= k) chars.resize(k + 1);
|
||||
if (!c.isPrint()) continue;
|
||||
|
||||
|
||||
chars[k].push_back(c);
|
||||
}
|
||||
}
|
||||
size = 30;
|
||||
QStringList cat;
|
||||
cat << tr("No Category") << tr("Mark NonSpacing") << tr("Mark SpacingCombining") << tr("Mark Enclosing")
|
||||
<< tr("Number DecimalDigit") << tr("Number Letter") << tr("Number Other") << tr("Separator Space")
|
||||
<< tr("Separator Line") << tr("Separator Paragraph") << tr("Other Control") << tr("Other Format")
|
||||
<< tr("Other Surrogate") << tr("Other PrivateUse") << tr("Other NotAssigned") << tr("Letter Uppercase")
|
||||
<< tr("Letter Lowercase") << tr("Letter Titlecase") << tr("Letter Modifier") << tr("Letter Other")
|
||||
cat << tr("No Category") << tr("Mark NonSpacing") << tr("Mark SpacingCombining") << tr("Mark Enclosing") << tr("Number DecimalDigit")
|
||||
<< tr("Number Letter") << tr("Number Other") << tr("Separator Space") << tr("Separator Line") << tr("Separator Paragraph")
|
||||
<< tr("Other Control") << tr("Other Format") << tr("Other Surrogate") << tr("Other PrivateUse") << tr("Other NotAssigned")
|
||||
<< tr("Letter Uppercase") << tr("Letter Lowercase") << tr("Letter Titlecase") << tr("Letter Modifier") << tr("Letter Other")
|
||||
<< tr("Punctuation Connector") << tr("Punctuation Dash") << tr("Punctuation Open") << tr("Punctuation Close")
|
||||
<< tr("Punctuation InitialQuote") << tr("Punctuation FinalQuote") << tr("Punctuation Other") << tr("Symbol Math")
|
||||
<< tr("Symbol Currency") << tr("Symbol Modifier") << tr("Symbol Other");
|
||||
@@ -53,13 +52,12 @@ void CharDialog::changeEvent(QEvent * e) {
|
||||
ui->retranslateUi(this);
|
||||
QStringList cat;
|
||||
cat << tr("No Category") << tr("Mark NonSpacing") << tr("Mark SpacingCombining") << tr("Mark Enclosing")
|
||||
<< tr("Number DecimalDigit") << tr("Number Letter") << tr("Number Other") << tr("Separator Space")
|
||||
<< tr("Separator Line") << tr("Separator Paragraph") << tr("Other Control") << tr("Other Format")
|
||||
<< tr("Other Surrogate") << tr("Other PrivateUse") << tr("Other NotAssigned") << tr("Letter Uppercase")
|
||||
<< tr("Letter Lowercase") << tr("Letter Titlecase") << tr("Letter Modifier") << tr("Letter Other")
|
||||
<< tr("Punctuation Connector") << tr("Punctuation Dash") << tr("Punctuation Open") << tr("Punctuation Close")
|
||||
<< tr("Punctuation InitialQuote") << tr("Punctuation FinalQuote") << tr("Punctuation Other") << tr("Symbol Math")
|
||||
<< tr("Symbol Currency") << tr("Symbol Modifier") << tr("Symbol Other");
|
||||
<< tr("Number DecimalDigit") << tr("Number Letter") << tr("Number Other") << tr("Separator Space") << tr("Separator Line")
|
||||
<< tr("Separator Paragraph") << tr("Other Control") << tr("Other Format") << tr("Other Surrogate") << tr("Other PrivateUse")
|
||||
<< tr("Other NotAssigned") << tr("Letter Uppercase") << tr("Letter Lowercase") << tr("Letter Titlecase")
|
||||
<< tr("Letter Modifier") << tr("Letter Other") << tr("Punctuation Connector") << tr("Punctuation Dash")
|
||||
<< tr("Punctuation Open") << tr("Punctuation Close") << tr("Punctuation InitialQuote") << tr("Punctuation FinalQuote")
|
||||
<< tr("Punctuation Other") << tr("Symbol Math") << tr("Symbol Currency") << tr("Symbol Modifier") << tr("Symbol Other");
|
||||
int pi = ui->comboCategory->currentIndex();
|
||||
ui->comboCategory->clear();
|
||||
ui->comboCategory->addItems(cat);
|
||||
@@ -71,15 +69,14 @@ void CharDialog::changeEvent(QEvent * e) {
|
||||
|
||||
bool CharDialog::eventFilter(QObject * o, QEvent * e) {
|
||||
if (o == ui->tableChars->viewport()) {
|
||||
if (e->type() != QEvent::Wheel)
|
||||
return QDialog::eventFilter(o, e);
|
||||
if (e->type() != QEvent::Wheel) return QDialog::eventFilter(o, e);
|
||||
qApp->sendEvent(ui->verticalScroll, e);
|
||||
}
|
||||
return QDialog::eventFilter(o, e);
|
||||
}
|
||||
|
||||
|
||||
void CharDialog::resizeEvent(QResizeEvent * ) {
|
||||
void CharDialog::resizeEvent(QResizeEvent *) {
|
||||
int r = ui->tableChars->contentsRect().height() / csize, c = ui->tableChars->contentsRect().width() / csize;
|
||||
ui->tableChars->setRowCount(r);
|
||||
ui->tableChars->setColumnCount(c);
|
||||
@@ -120,15 +117,17 @@ void CharDialog::on_verticalScroll_valueChanged(int index) {
|
||||
for (int i = 0; i < ui->tableChars->rowCount(); ++i) {
|
||||
for (int j = 0; j < ui->tableChars->columnCount(); ++j) {
|
||||
++ci;
|
||||
if (cur->size() > ci) ui->tableChars->item(i, j)->setText(cur->at(ci));
|
||||
else ui->tableChars->item(i, j)->setText(QString());
|
||||
if (cur->size() > ci)
|
||||
ui->tableChars->item(i, j)->setText(cur->at(ci));
|
||||
else
|
||||
ui->tableChars->item(i, j)->setText(QString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CharDialog::on_spinSize_valueChanged(int index) {
|
||||
size = index;
|
||||
size = index;
|
||||
csize = size * 2;
|
||||
ui->tableChars->horizontalHeader()->setDefaultSectionSize(csize);
|
||||
ui->tableChars->verticalHeader()->setDefaultSectionSize(csize);
|
||||
|
||||
Reference in New Issue
Block a user