You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
188 lines
7.1 KiB
C++
188 lines
7.1 KiB
C++
/******************************************************************************
|
|
Copyright(C):2015~2018 hzleaper
|
|
FileName:$FILE_BASE$.$FILE_EXT$
|
|
Author:zhikun wu
|
|
Email:zk.wu@hzleaper.com
|
|
Tools:vs2010 pc on company
|
|
Created:$DATE$
|
|
History:$DAY$:$MONTH$:$YEAR$ $HOUR$:$MINUTE$
|
|
*******************************************************************************/
|
|
#ifndef __TP_GUI_HEADER_H
|
|
#define __TP_GUI_HEADER_H
|
|
|
|
#include <QtCore\qobject.h>
|
|
#include <QtCore\qvariant.h>
|
|
#include <QtGui\qimage.h>
|
|
|
|
#include "QTpListWidget.h"
|
|
#include "QTpStackedWidget.h"
|
|
/*
|
|
class QTpObject : public QObject
|
|
{
|
|
public:
|
|
QTpObject(QObject *parent = NULL)
|
|
: QObject(parent) {}
|
|
virtual ~QTpObject() {}
|
|
// virtual bool ActionTrigger(class QObject* pAction, bool bChecked) = 0;
|
|
};
|
|
*/
|
|
|
|
typedef QList<QWidget*> QTpWidgetList;
|
|
typedef QList<QObject*> QTpObjectList;
|
|
typedef QMap<QString, QString> QTpStrStrMap;
|
|
|
|
#define TP_APP_MAIN_WIDGET_NAME "main"
|
|
|
|
#define TP_GLOBAL_ACTION_FULL_SCREEN "tp_global_action_full_screen"
|
|
#define TP_GLOBAL_PUSHBUTTON_FULL_SCREEN "tp_global_button_full_screen"
|
|
#define TP_GLOBAL_ACTION_OPEN_IMAGES "tp_global_action_open_images"
|
|
#define TP_GLOBAL_PUSHBUTTON_OPEN_IMAGES "tp_global_button_open_images"
|
|
#define TP_GLOBAL_WIDGET_THUMBNAIL_DEFAULT "tp_global_widget_thumbnail_default"
|
|
#define TP_GLOBAL_LISTWIDGET_THUMBNAIL "tp_global_listwidget_thumbnail"
|
|
|
|
#define TP_GLOBAL_DIALOG_PUSHBUTTON_OK "tp_global_dialog_pushbutton_ok"
|
|
#define TP_GLOBAL_DIALOG_PUSHBUTTON_CANCEL "tp_global_dialog_pushbutton_cancel"
|
|
|
|
#define TP_GLOBAL_BUTTON_OPEN_KEYBOARD "tp_global_dialog_pushbutton_keyboard"
|
|
|
|
|
|
#define WIDGET_UI_FILE_HEAD "WIDGET_UI_FILE_"
|
|
//property names
|
|
#define TP_PROP_STRING_WIDGET_KEY "tp_prop_string_widget_key"
|
|
#define TP_PROP_BOOL_HIDE_TITLE_WIDGET "tp_prop_bool_hide_title_widget"
|
|
#define TP_PROP_BOOL_FULL_SCREEN "tp_prop_bool_full_screen"
|
|
#define TP_PROP_BOOL_STAY_ON_TOP "tp_prop_bool_stay_on_top"
|
|
#define TP_PROP_BOOL_NO_DOCK_FEATURE "tp_prop_bool_no_dock_feature"
|
|
#define TP_PROP_BOOL_CLOSE_TO_DELETE "tp_prop_bool_close_to_delete"
|
|
#define TP_PROP_BOOL_DOUBLE_CLICKED_TO_ZOOM "tp_prop_bool_double_clicked_to_zoom"
|
|
#define TP_PROP_BOOL_START_TO_HIDE_WIDGET "tp_prop_bool_start_to_hide_widget"
|
|
|
|
#define TP_PROP_STRING_CLICKED_TO_SHOW_DOCKWIDGET "tp_prop_string_clicked_to_show_dockwidget"
|
|
#define TP_PROP_STRING_CLICKED_TO_OPEN_UI_FILE "tp_prop_string_clicked_to_open_ui_file"
|
|
#define TP_PROP_STRING_DOUBLE_CLICKED_TO_OPEN_UI_FILE "tp_prop_string_double_clicked_to_open_ui_file"
|
|
#define TP_PROP_STRING_DIR_PATH "tp_prop_string_dir_path"
|
|
#define TP_PROP_STRINGLIST_SELECTED_FILES "tp_prop_stringlist_slected_files"
|
|
#define TP_PROP_STRING_EDIT_VALUE_SLIDE "tp_prop_string_edit_value_slide"//property in edit, value is the name of a slider
|
|
#define TP_PROP_STRING_SLIDE_VALUE_EDIT "tp_prop_string_slide_value_edit"//property in slide, value is the name of a edit
|
|
//#define TP_PROP_BOOL_SCROLL_AREA_VERTICAL_EXTEND "tp_prop_bool_scroll_area_vertical_extend"
|
|
//#define TP_PROP_INT_SCROLL_AREA_LIMITS "tp_prop_int_scroll_area_limits"
|
|
//#define TP_PROP_STRING_SCROLL_AREA_NODE_UI_FILE "tp_prop_string_scroll_area_node_ui_file"
|
|
#define TP_PROP_STRING_UI_FILE_EXTEND "tp_prop_string_ui_file_extend"
|
|
#define TP_PROP_POINTSLIST_CURVE "tp_prop_pointslist_curve"
|
|
//for TP_GLOBAL_WIDGET_ZOOM_IMAGE//原图放到窗口相关的属性和对象名称
|
|
//#define TP_GLOBAL_WIDGET_THUMBNAIL "tp_global_widget_thumbnail"
|
|
//#define TP_GLOBAL_WIDGET_IMAGE "tp_global_widget_image"//the widget only for drawing image
|
|
#define TP_GLOBAL_WIDGET_ZOOM_IMAGE "tp_global_widget_zoom_image"
|
|
#define TP_PROP_QIMAGE_FOR_ZOOM "tp_prop_qimage_for_zoom"
|
|
#define TP_PROP_STRING_FOR_ZOOM "tp_prop_string_for_zoom"//whole name of the image's file
|
|
#define TP_PROP_FLOAT_SCALE_FOR_ZOOM "tp_prop_float_scale_for_zoom"//1.0 is original scale
|
|
//
|
|
//#define TP_GLOBAL_WIDGET_THUMBTAIL_MAIN "tp_global_widget_thumbtail_main"
|
|
//#define TP_GLOBAL_WIDGET_THUMBTAIL_LAYOUT "tp_global_widget_thumbtail_layout"
|
|
//
|
|
#define TP_PROP_STRING_OPENED_BY_OBJECT "tp_prop_string_opened_by_object"
|
|
#define TP_GLOBAL_TABLE_WIDGET_JSONS "tp_global_table_widget_jsons"
|
|
#define TP_PROP_STRINGLIST_TABLE_WIDGET_JSON_KEYS "tp_prop_stringlist_table_widget_json_keys"
|
|
|
|
#define TP_PROP_STRING_WIDGET_JSON_FILE "tp_prop_string_widget_json_file"
|
|
|
|
#define TP_PROP_STRINGLIST_COMBOBOX_VALUES "tp_prop_stringlist_combobox_values"
|
|
#define TP_PROP_STRING_SHILFT "tp_prop_string_shilft"
|
|
|
|
#define TP_GLOBAL_CONFIG_DIALOG "tp_global_config_dialog"
|
|
|
|
inline bool tp_check_bool_property(const char* sname, const QObject* pObj)
|
|
{
|
|
QVariant var = pObj->property(sname);
|
|
if (!var.isValid())
|
|
{
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
return var.toBool();
|
|
}
|
|
}
|
|
|
|
inline QString tp_check_string_property(const char* name, const QObject* pObj)
|
|
{
|
|
QVariant var = pObj->property(name);
|
|
if (!var.isValid())
|
|
{
|
|
return NULL;
|
|
}
|
|
else
|
|
{
|
|
return var.toString();
|
|
}
|
|
}
|
|
|
|
inline QStringList tp_check_stringlist_property(const char* name, const QObject* pObj)
|
|
{
|
|
QVariant var = pObj->property(name);
|
|
if (!var.isValid())
|
|
{
|
|
return QStringList();
|
|
}
|
|
else
|
|
{
|
|
return var.toStringList();
|
|
}
|
|
}
|
|
|
|
inline float tp_check_float_property(const char* name, const QObject* pObj, float def = 0.0)
|
|
{
|
|
QVariant var = pObj->property(name);
|
|
if (!var.isValid())
|
|
{
|
|
return def;
|
|
}
|
|
else
|
|
{
|
|
bool bOk;
|
|
float fv = var.toFloat(&bOk);
|
|
if (bOk)
|
|
{
|
|
return fv;
|
|
}
|
|
else
|
|
{
|
|
return def;
|
|
}
|
|
}
|
|
}
|
|
|
|
inline QImage tp_check_qimage_property(const char* name, const QObject* pObj)
|
|
{
|
|
QVariant var = pObj->property(name);
|
|
if (!var.isValid() || !var.canConvert<QImage>())
|
|
{
|
|
return QImage();
|
|
}
|
|
return var.value<QImage>();
|
|
}
|
|
|
|
inline bool tp_shilf_string_property(QString& prop, QObject* pObj)
|
|
{
|
|
QString btnText = tp_check_string_property(TP_PROP_STRING_SHILFT, pObj);
|
|
if (!btnText.isEmpty())
|
|
{
|
|
pObj->setProperty(TP_PROP_STRING_SHILFT, prop);
|
|
prop = btnText;
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
class CTpThumbnail
|
|
{
|
|
public:
|
|
CTpThumbnail() {}
|
|
~CTpThumbnail() {}
|
|
static void AddImage();
|
|
};
|
|
|
|
#endif |