File indexing completed on 2024-05-12 04:57:49

0001 /**
0002 * Copyright (c) 2009, Benjamin C. Meyer <ben@meyerhome.net>
0003 *
0004 * Redistribution and use in source and binary forms, with or without
0005 * modification, are permitted provided that the following conditions
0006 * are met:
0007 * 1. Redistributions of source code must retain the above copyright
0008 * notice, this list of conditions and the following disclaimer.
0009 * 2. Redistributions in binary form must reproduce the above copyright
0010 * notice, this list of conditions and the following disclaimer in the
0011 * documentation and/or other materials provided with the distribution.
0012 * 3. Neither the name of the Benjamin Meyer nor the names of its contributors
0013 * may be used to endorse or promote products derived from this software
0014 * without specific prior written permission.
0015 *
0016 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
0017 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0018 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0019 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
0020 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0021 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
0022 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
0023 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
0024 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
0025 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
0026 * SUCH DAMAGE.
0027 */
0028 
0029 #ifndef SQUEEZELABELV1_H
0030 #define SQUEEZELABELV1_H
0031 
0032 #include "qzcommon.h"
0033 
0034 #include <QLabel>
0035 
0036 /*
0037 A label that will squeeze the set text to fit within the size of the
0038 widget. The text will be elided in the middle.
0039 */
0040 class FALKON_EXPORT SqueezeLabelV1 : public QLabel
0041 {
0042     Q_OBJECT
0043 
0044 public:
0045     SqueezeLabelV1(QWidget* parent = nullptr);
0046 
0047 protected:
0048     void paintEvent(QPaintEvent* event) override;
0049 
0050 private:
0051     QString m_SqueezedTextCache;
0052 };
0053 
0054 #endif // SQUEEZELABELV1_H