<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://mochiu.net/index.php?action=history&amp;feed=atom&amp;title=Qt%E3%81%AE%E5%9F%BA%E7%A4%8E_-_%E3%82%B7%E3%83%B3%E3%82%B0%E3%83%AB%E3%83%88%E3%83%B3</id>
	<title>Qtの基礎 - シングルトン - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://mochiu.net/index.php?action=history&amp;feed=atom&amp;title=Qt%E3%81%AE%E5%9F%BA%E7%A4%8E_-_%E3%82%B7%E3%83%B3%E3%82%B0%E3%83%AB%E3%83%88%E3%83%B3"/>
	<link rel="alternate" type="text/html" href="https://mochiu.net/index.php?title=Qt%E3%81%AE%E5%9F%BA%E7%A4%8E_-_%E3%82%B7%E3%83%B3%E3%82%B0%E3%83%AB%E3%83%88%E3%83%B3&amp;action=history"/>
	<updated>2026-08-20T05:37:37Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.43.9</generator>
	<entry>
		<id>https://mochiu.net/index.php?title=Qt%E3%81%AE%E5%9F%BA%E7%A4%8E_-_%E3%82%B7%E3%83%B3%E3%82%B0%E3%83%AB%E3%83%88%E3%83%B3&amp;diff=11561&amp;oldid=prev</id>
		<title>Wiki: 文字列「__FORCETOC__」を「{{#seo:
|title={{PAGENAME}} : Exploring Electronics and SUSE Linux | MochiuWiki
|keywords=MochiuWiki,Mochiu,Wiki,Mochiu Wiki,Electric Circuit,Electric,pcb,Mathematics,AVR,TI,STMicro,AVR,ATmega,MSP430,STM,Arduino,Xilinx,FPGA,Verilog,HDL,PinePhone,Pine Phone,Raspberry,Raspberry Pi,C,C++,C#,Qt,Qml,MFC,Shell,Bash,Zsh,Fish,SUSE,SLE,Suse Enterprise,Suse Linux,openSUSE,open SUSE,Leap,Linux,uCLnux,Podman,電気回路,電子回路,基板,プリント基板
|description={{PAGENAME}} - 電子回路とSUSE Linuxに関する情報 | This pag…</title>
		<link rel="alternate" type="text/html" href="https://mochiu.net/index.php?title=Qt%E3%81%AE%E5%9F%BA%E7%A4%8E_-_%E3%82%B7%E3%83%B3%E3%82%B0%E3%83%AB%E3%83%88%E3%83%B3&amp;diff=11561&amp;oldid=prev"/>
		<updated>2024-10-14T01:58:42Z</updated>

		<summary type="html">&lt;p&gt;文字列「__FORCETOC__」を「{{#seo: |title={{PAGENAME}} : Exploring Electronics and SUSE Linux | MochiuWiki |keywords=MochiuWiki,Mochiu,Wiki,Mochiu Wiki,Electric Circuit,Electric,pcb,Mathematics,AVR,TI,STMicro,AVR,ATmega,MSP430,STM,Arduino,Xilinx,FPGA,Verilog,HDL,PinePhone,Pine Phone,Raspberry,Raspberry Pi,C,C++,C#,Qt,Qml,MFC,Shell,Bash,Zsh,Fish,SUSE,SLE,Suse Enterprise,Suse Linux,openSUSE,open SUSE,Leap,Linux,uCLnux,Podman,電気回路,電子回路,基板,プリント基板 |description={{PAGENAME}} - 電子回路とSUSE Linuxに関する情報 | This pag…&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2024年10月14日 (月) 10:58時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l117&quot;&gt;117行目:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;117行目:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{{#seo:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;|title={{PAGENAME}} : Exploring Electronics and SUSE Linux | MochiuWiki&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;|keywords=MochiuWiki,Mochiu,Wiki,Mochiu Wiki,Electric Circuit,Electric,pcb,Mathematics,AVR,TI,STMicro,AVR,ATmega,MSP430,STM,Arduino,Xilinx,FPGA,Verilog,HDL,PinePhone,Pine Phone,Raspberry,Raspberry Pi,C,C++,C#,Qt,Qml,MFC,Shell,Bash,Zsh,Fish,SUSE,SLE,Suse Enterprise,Suse Linux,openSUSE,open SUSE,Leap,Linux,uCLnux,Podman,電気回路,電子回路,基板,プリント基板&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;|description={{PAGENAME}} - 電子回路とSUSE Linuxに関する情報 | This page is {{PAGENAME}} in our wiki about electronic circuits and SUSE Linux&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;|image=/resources/assets/MochiuLogo_Single_Blue.png&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;}}&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;__FORCETOC__&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;__FORCETOC__&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[カテゴリ:Qt]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[カテゴリ:Qt]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Wiki</name></author>
	</entry>
	<entry>
		<id>https://mochiu.net/index.php?title=Qt%E3%81%AE%E5%9F%BA%E7%A4%8E_-_%E3%82%B7%E3%83%B3%E3%82%B0%E3%83%AB%E3%83%88%E3%83%B3&amp;diff=9792&amp;oldid=prev</id>
		<title>Wiki: ページの作成:「== 概要 == オブジェクト指向のプログラム言語のクラスのデザインパターンの1種である。&lt;br&gt; デザインパターンとは、オブジェクト指向の言語で使用される設計のパターンのことであり、設計時に直面する問題とその解決策を整理してまとめたものを指す。&lt;br&gt; &lt;br&gt; シングルトンは、クラスの設計方法の1つであり、クラスのインスタンスを2つ以上生成…」</title>
		<link rel="alternate" type="text/html" href="https://mochiu.net/index.php?title=Qt%E3%81%AE%E5%9F%BA%E7%A4%8E_-_%E3%82%B7%E3%83%B3%E3%82%B0%E3%83%AB%E3%83%88%E3%83%B3&amp;diff=9792&amp;oldid=prev"/>
		<updated>2024-03-27T16:51:13Z</updated>

		<summary type="html">&lt;p&gt;ページの作成:「== 概要 == オブジェクト指向のプログラム言語のクラスのデザインパターンの1種である。&amp;lt;br&amp;gt; デザインパターンとは、オブジェクト指向の言語で使用される設計のパターンのことであり、設計時に直面する問題とその解決策を整理してまとめたものを指す。&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; シングルトンは、クラスの設計方法の1つであり、クラスのインスタンスを2つ以上生成…」&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== 概要 ==&lt;br /&gt;
オブジェクト指向のプログラム言語のクラスのデザインパターンの1種である。&amp;lt;br&amp;gt;&lt;br /&gt;
デザインパターンとは、オブジェクト指向の言語で使用される設計のパターンのことであり、設計時に直面する問題とその解決策を整理してまとめたものを指す。&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
シングルトンは、クラスの設計方法の1つであり、クラスのインスタンスを2つ以上生成できないようにすることで、常に同一のインスタンスが参照されるデザインパターンとなる。&amp;lt;br&amp;gt;&lt;br /&gt;
例えば、インスタンスの状態を常に持つ場合やクラス端で共通のデータとしてアクセスする必要がある場合に使用される。&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 使用例 : ログクラス ==&lt;br /&gt;
ログファイルの操作を行うクラスをシングルトンパターンで設計することは、&amp;lt;br&amp;gt;&lt;br /&gt;
アプリケーション全体で1つのログファイルインスタンスのみを保持して、統一されたアクセスポイントを提供するための一般的な方法である。&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
シングルトンパターンを使用することにより、異なるコンポーネントからのログメッセージが1つのログファイルに順序よく書き込まれることが保証できる。&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
以下の例では、指定されたパスでログファイルを開き、ログファイルになんらかの文字列を書き込んでいる。&amp;lt;br&amp;gt;&lt;br /&gt;
もし、ログファイルが存在しない場合はファイルを作成する。&amp;lt;br&amp;gt;&lt;br /&gt;
また、ファイルのオープンに失敗した場合はエラーを返す。&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot;&amp;gt;&lt;br /&gt;
 // Logger.hファイル&lt;br /&gt;
 &lt;br /&gt;
 #ifndef LOGGER_H&lt;br /&gt;
 #define LOGGER_H&lt;br /&gt;
 &lt;br /&gt;
 #include &amp;lt;QCoreApplication&amp;gt;&lt;br /&gt;
 #include &amp;lt;QFile&amp;gt;&lt;br /&gt;
 #include &amp;lt;QTextStream&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 class Logger {&lt;br /&gt;
 private:&lt;br /&gt;
    bool        m_LogFileOpened;&lt;br /&gt;
    QFile       m_LogFile;&lt;br /&gt;
    QTextStream m_Textout;&lt;br /&gt;
 &lt;br /&gt;
 private:&lt;br /&gt;
    Logger();  // プライベートコンストラクタ&lt;br /&gt;
    ~Logger(); // デストラクタ&lt;br /&gt;
    Logger(const Logger &amp;amp;rhs) = delete; // コピー禁止&lt;br /&gt;
    Logger &amp;amp;operator=(const Logger &amp;amp;rhs) = delete; // 代入禁止&lt;br /&gt;
    bool isLogFileOpen() const;&lt;br /&gt;
 &lt;br /&gt;
 public:&lt;br /&gt;
    static Logger&amp;amp; instance();&lt;br /&gt;
    void writeLog(const QString &amp;amp;message);&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 #endif // LOGGER_H&lt;br /&gt;
 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot;&amp;gt;&lt;br /&gt;
 // Logger.cpp&lt;br /&gt;
 &lt;br /&gt;
 #include &amp;lt;QFileInfo&amp;gt;&lt;br /&gt;
 #include &amp;quot;logger.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 Logger::Logger() : m_LogFileOpened(false)&lt;br /&gt;
 {&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 Logger::~Logger()&lt;br /&gt;
 {&lt;br /&gt;
    if (m_LogFile.isOpen()) {&lt;br /&gt;
       m_LogFile.close();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 Logger&amp;amp; Logger::instance(const QString &amp;amp;filePath)&lt;br /&gt;
 {&lt;br /&gt;
    static Logger instance;  // シングルトンインスタンスの生成&lt;br /&gt;
 &lt;br /&gt;
    if (!instance.m_LogFile.isOpen() &amp;amp;&amp;amp; !filePath.isEmpty()) {&lt;br /&gt;
       // ログファイルを開く&lt;br /&gt;
       instance.m_LogFile.setFileName(filePath);&lt;br /&gt;
       instance.m_LogFileOpened = instance.m_LogFile.open(QIODevice::WriteOnly | QIODevice::Append);&lt;br /&gt;
       if (instance.m_LogFileOpened) {&lt;br /&gt;
          instance.m_Textout.setDevice(&amp;amp;instance.m_LogFile);&lt;br /&gt;
       }&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    return instance;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void Logger::writeLog(const QString &amp;amp;message)&lt;br /&gt;
 {&lt;br /&gt;
    if (m_LogFileOpened) {&lt;br /&gt;
       // ファイルを直ちに書き込む&lt;br /&gt;
       m_Textout &amp;lt;&amp;lt; message &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;;&lt;br /&gt;
       m_Textout.flush();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 bool Logger::isLogFileOpen() const&lt;br /&gt;
 {&lt;br /&gt;
    return m_LogFileOpened;&lt;br /&gt;
 }&lt;br /&gt;
 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
上記のクラスでは、Loggerクラスのインスタンスを取得する時に、ログファイルのパスをinstanceメソッドに渡す。&amp;lt;br&amp;gt;&lt;br /&gt;
Loggerクラスのインスタンスが初めて要求された時、指定されたパスでログファイルを開こうと試みる。&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
ログファイルが存在しない場合は、ファイルを新規作成する。&amp;lt;br&amp;gt;&lt;br /&gt;
ログファイルの作成に失敗した場合は、writeLogメソッドを呼び出しても何も処理が行われないようにエラーハンドリングしている。&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
また、isLogFileOpenメソッドを実行することにより、ログファイルが正常に開かれたかどうかを確認することができる。&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot;&amp;gt;&lt;br /&gt;
 QString logFilePath = &amp;quot;/tmp/logfile.log&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 Logger &amp;amp;logger = Logger::instance(logFilePath);&lt;br /&gt;
 if (logger.isLogFileOpen()) {&lt;br /&gt;
    logger.writeLog(&amp;quot;This is a sample message.&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 else {&lt;br /&gt;
    // ログファイルのオープンに失敗した場合&lt;br /&gt;
    // ...略&lt;br /&gt;
 }&lt;br /&gt;
 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__FORCETOC__&lt;br /&gt;
[[カテゴリ:Qt]]&lt;/div&gt;</summary>
		<author><name>Wiki</name></author>
	</entry>
</feed>