Skip to content

Commit

Permalink
更新JQLibrary
Browse files Browse the repository at this point in the history
  • Loading branch information
188080501 committed Jan 1, 2018
1 parent 0c857eb commit e5cc5a3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 87 deletions.
6 changes: 3 additions & 3 deletions library/JQLibrary/JQLibrary.pri
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ contains( QT, network ) {
}
}

exists( $$PWD/src/JQTranslation.cpp ) {
exists( $$PWD/src/jqthread.cpp ) {

SOURCES *= $$PWD/src/JQTranslation.cpp
HEADERS *= $$PWD/include/JQTranslation.h
SOURCES *= $$PWD/src/jqthread.cpp
HEADERS *= $$PWD/include/jqthread.h
}

contains( QT, multimedia | concurrent ) {
Expand Down
6 changes: 3 additions & 3 deletions library/JQLibrary/include/JQFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
*/

#ifndef JQFILE_H_
#define JQFILE_H_
#ifndef JQLIBRARY_INCLUDE_JQFILE_H_
#define JQLIBRARY_INCLUDE_JQFILE_H_

// C++ lib import
#include <functional>
Expand Down Expand Up @@ -52,4 +52,4 @@ bool setFileLastReadAndLastModifiedTime(const char *fileName, const quint32 &las

}

#endif//JQFILE_H_
#endif//JQLIBRARY_INCLUDE_JQFILE_H_
18 changes: 3 additions & 15 deletions library/JQLibrary/include/JQFoundation.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
*/

#ifndef JQFOUNDATION_H_
#define JQFOUNDATION_H_
#ifndef JQLIBRARY_INCLUDE_JQFOUNDATION_H_
#define JQLIBRARY_INCLUDE_JQFOUNDATION_H_

#if ((__cplusplus < 201103) && !(defined _MSC_VER)) || ((defined _MSC_VER) && (_MSC_VER < 1800))
# error("Please add c++11 config on pro file")
Expand Down Expand Up @@ -168,23 +168,11 @@ QByteArray pixmapToByteArray(const QPixmap &pixmap, const QString &format, int q

QByteArray imageToByteArray(const QImage &image, const QString &format, int quality = -1);

QPixmap byteArrayToPixmap(const QByteArray &byteArray);

#if ( ( defined Q_OS_MAC ) && !( defined Q_OS_IOS ) ) || ( defined Q_OS_WIN ) || ( defined Q_OS_LINUX )
QPair< int, QByteArray > startProcessAndReadOutput(const QString &program, const QStringList &arguments, const int &maximumTime = 5 * 1000);
#endif

#ifdef QT_WIDGETS_LIB
void tableWidgetSetHorizontalHeaderLabels(QTableWidget *tableWidget, const QStringList &stringList);

void tableWidgetSetColumnWidth(QTableWidget *tableWidget, const QVector<int> &columnWidth);

void tableWidgetAddString(QTableWidget *tablwWidget, const QStringList &string);

void treeWidgetSetHorizontalHeaderLabels(QTreeWidget *treeWidget, const QStringList &ttringList);

void treeWidgetSetColumnWidth(QTreeWidget *treeWidget, const QVector<int> &columnWidth);

void setWidgetColor(QWidget *label, const QColor &color);

void texetEditMoveCursorToEnd(QTextEdit *textEdit);
Expand Down Expand Up @@ -250,4 +238,4 @@ QMap< Key, T > mapMix(const QMap< Key, T > &source, const QMap< Key, T > &mix)

}

#endif//JQFOUNDATION_H_
#endif//JQLIBRARY_INCLUDE_JQFOUNDATION_H_
66 changes: 0 additions & 66 deletions library/JQLibrary/src/JQFoundation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,15 +424,6 @@ QByteArray JQFoundation::imageToByteArray(const QImage &image, const QString &fo
return bytes;
}

QPixmap JQFoundation::byteArrayToPixmap(const QByteArray &byteArray)
{
QPixmap Pixmap;

Pixmap.loadFromData(byteArray);

return Pixmap;
}

#if ( ( defined Q_OS_MAC ) && !( defined Q_OS_IOS ) ) || ( defined Q_OS_WIN ) || ( defined Q_OS_LINUX )
QPair< int, QByteArray > JQFoundation::startProcessAndReadOutput(const QString &program, const QStringList &arguments, const int &maximumTime)
{
Expand All @@ -459,63 +450,6 @@ QPair< int, QByteArray > JQFoundation::startProcessAndReadOutput(const QString &
#endif

#ifdef QT_WIDGETS_LIB
void JQFoundation::tableWidgetSetHorizontalHeaderLabels(QTableWidget *tableWidget, const QStringList &stringList)
{
tableWidget->setColumnCount(stringList.size());
tableWidget->setHorizontalHeaderLabels(stringList);
}

void JQFoundation::tableWidgetSetColumnWidth(QTableWidget *tableWidget, const QVector<int> &columnWidth)
{
int column = -1;
foreach (auto &&now, columnWidth)
{
tableWidget->setColumnWidth(++column, now);
}
}

void JQFoundation::tableWidgetAddString(QTableWidget *tableWidget, const QStringList &stringList)
{
int x = 0, y = tableWidget->rowCount();
tableWidget->setRowCount(y + 1);
QTableWidgetItem *item;

foreach (QString Now, stringList)
{
item = new QTableWidgetItem(Now);
item->setSelected(false);
item->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
tableWidget->setItem(y, x++, item);
}
}

void JQFoundation::treeWidgetSetHorizontalHeaderLabels(QTreeWidget *treeWidget, const QStringList &stringList)
{
treeWidget->setColumnCount(stringList.size());
treeWidget->setHeaderLabels(stringList);
}

void JQFoundation::treeWidgetSetColumnWidth(QTreeWidget *treeWidget, const QVector<int> &columnWidth)
{
int column = -1;
foreach (auto &&now, columnWidth)
{
++column;
if (now > 0)
{
treeWidget->setColumnWidth(column, now);
}
else if (!now)
{
continue;
}
else
{
treeWidget->setColumnWidth(column, treeWidget->headerItem()->text(column).size() * abs(now));
}
}
}

void JQFoundation::setWidgetColor(QWidget *label, const QColor &color)
{
QPalette palette;
Expand Down

0 comments on commit e5cc5a3

Please sign in to comment.