fix -Wextra & -Wdeprecated in Drawing
This commit is contained in:
@@ -50,7 +50,6 @@
|
||||
# include <QSvgRenderer>
|
||||
# include <QSvgWidget>
|
||||
# include <QWheelEvent>
|
||||
# include <strstream>
|
||||
# include <cmath>
|
||||
#endif
|
||||
|
||||
@@ -381,7 +380,7 @@ void DrawingView::setRenderer(QAction *action)
|
||||
}
|
||||
}
|
||||
|
||||
bool DrawingView::onMsg(const char* pMsg, const char** ppReturn)
|
||||
bool DrawingView::onMsg(const char* pMsg, const char** )
|
||||
{
|
||||
if (strcmp("ViewFit",pMsg) == 0) {
|
||||
viewAll();
|
||||
@@ -613,53 +612,53 @@ void DrawingView::print(QPrinter* printer)
|
||||
|
||||
QPrinter::PageSize DrawingView::getPageSize(int w, int h) const
|
||||
{
|
||||
static const float paperSizes[][2] = {
|
||||
{210, 297}, // A4
|
||||
{176, 250}, // B5
|
||||
{215.9f, 279.4f}, // Letter
|
||||
{215.9f, 355.6f}, // Legal
|
||||
{190.5f, 254}, // Executive
|
||||
{841, 1189}, // A0
|
||||
{594, 841}, // A1
|
||||
{420, 594}, // A2
|
||||
{297, 420}, // A3
|
||||
{148, 210}, // A5
|
||||
{105, 148}, // A6
|
||||
{74, 105}, // A7
|
||||
{52, 74}, // A8
|
||||
{37, 52}, // A8
|
||||
{1000, 1414}, // B0
|
||||
{707, 1000}, // B1
|
||||
{31, 44}, // B10
|
||||
{500, 707}, // B2
|
||||
{353, 500}, // B3
|
||||
{250, 353}, // B4
|
||||
{125, 176}, // B6
|
||||
{88, 125}, // B7
|
||||
{62, 88}, // B8
|
||||
{33, 62}, // B9
|
||||
{163, 229}, // C5E
|
||||
{105, 241}, // US Common
|
||||
{110, 220}, // DLE
|
||||
{210, 330}, // Folio
|
||||
{431.8f, 279.4f}, // Ledger
|
||||
{279.4f, 431.8f} // Tabloid
|
||||
};
|
||||
|
||||
static const float paperSizes[][2] = {
|
||||
{210, 297}, // A4
|
||||
{176, 250}, // B5
|
||||
{215.9f, 279.4f}, // Letter
|
||||
{215.9f, 355.6f}, // Legal
|
||||
{190.5f, 254}, // Executive
|
||||
{841, 1189}, // A0
|
||||
{594, 841}, // A1
|
||||
{420, 594}, // A2
|
||||
{297, 420}, // A3
|
||||
{148, 210}, // A5
|
||||
{105, 148}, // A6
|
||||
{74, 105}, // A7
|
||||
{52, 74}, // A8
|
||||
{37, 52}, // A8
|
||||
{1000, 1414}, // B0
|
||||
{707, 1000}, // B1
|
||||
{31, 44}, // B10
|
||||
{500, 707}, // B2
|
||||
{353, 500}, // B3
|
||||
{250, 353}, // B4
|
||||
{125, 176}, // B6
|
||||
{88, 125}, // B7
|
||||
{62, 88}, // B8
|
||||
{33, 62}, // B9
|
||||
{163, 229}, // C5E
|
||||
{105, 241}, // US Common
|
||||
{110, 220}, // DLE
|
||||
{210, 330}, // Folio
|
||||
{431.8f, 279.4f}, // Ledger
|
||||
{279.4f, 431.8f} // Tabloid
|
||||
};
|
||||
|
||||
QPrinter::PageSize ps = QPrinter::Custom;
|
||||
for (int i=0; i<30; i++) {
|
||||
if (std::abs(paperSizes[i][0]-w) <= 1 &&
|
||||
std::abs(paperSizes[i][1]-h) <= 1) {
|
||||
ps = static_cast<QPrinter::PageSize>(i);
|
||||
break;
|
||||
}
|
||||
else
|
||||
if (std::abs(paperSizes[i][0]-h) <= 1 &&
|
||||
std::abs(paperSizes[i][1]-w) <= 1) {
|
||||
ps = static_cast<QPrinter::PageSize>(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int i=0; i<30; i++) {
|
||||
if (std::abs(paperSizes[i][0]-w) <= 1 &&
|
||||
std::abs(paperSizes[i][1]-h) <= 1) {
|
||||
ps = static_cast<QPrinter::PageSize>(i);
|
||||
break;
|
||||
}
|
||||
else
|
||||
if (std::abs(paperSizes[i][0]-h) <= 1 &&
|
||||
std::abs(paperSizes[i][1]-w) <= 1) {
|
||||
ps = static_cast<QPrinter::PageSize>(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ps;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user